ItEr42S13ImplantacionAplicacionItEr41S16: Fixed problem with OrderElementServiceTest::orderWithInvalidMaterialAssignment.
This commit is contained in:
parent
da335ba08e
commit
4295483dee
2 changed files with 13 additions and 4 deletions
|
|
@ -426,6 +426,11 @@ public final class OrderElementConverter {
|
|||
.getMaterialCategory();
|
||||
material.setCategory(defaultMaterialCategory);
|
||||
|
||||
/*
|
||||
* "validate" method avoids that "material" goes to the Hibernate's
|
||||
* session if "material" is not valid.
|
||||
*/
|
||||
material.validate();
|
||||
Registry.getMaterialDAO().save(material);
|
||||
}
|
||||
|
||||
|
|
@ -447,6 +452,11 @@ public final class OrderElementConverter {
|
|||
throw new RuntimeException(e);
|
||||
} catch (InstanceNotFoundException e) {
|
||||
labelType = LabelType.create(labelDTO.type);
|
||||
/*
|
||||
* "validate" method avoids that "labelType" goes to the Hibernate's
|
||||
* session if "labelType" is not valid.
|
||||
*/
|
||||
labelType.validate();
|
||||
Registry.getLabelTypeDAO().save(labelType);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ import org.hamcrest.Description;
|
|||
import org.hamcrest.Matcher;
|
||||
import org.joda.time.LocalDate;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.navalplanner.business.IDataBootstrap;
|
||||
|
|
@ -425,7 +424,6 @@ public class OrderElementServiceTest {
|
|||
equalTo(previous + 1));
|
||||
}
|
||||
|
||||
@Ignore
|
||||
@Test
|
||||
public void orderWithInvalidMaterialAssignment() {
|
||||
int previous = orderDAO.getOrders().size();
|
||||
|
|
@ -444,8 +442,9 @@ public class OrderElementServiceTest {
|
|||
|
||||
List<ConstraintViolationDTO> constraintViolations = instanceConstraintViolationsList
|
||||
.get(0).constraintViolations;
|
||||
// Mandatory fields: material, units, unitPrice
|
||||
assertThat(constraintViolations.size(), equalTo(3));
|
||||
// Mandatory fields: material code
|
||||
assertThat(constraintViolations.size(), equalTo(1));
|
||||
assertThat(constraintViolations.get(0).fieldName, mustEnd("code"));
|
||||
|
||||
assertThat(orderDAO.getOrders().size(), equalTo(previous));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue