ItEr41S15CUImportacionRecursosProductivosItEr40S20: Test case added to check criterion and criterion type names when importing resources.
Test case added to check criterion and criterion type names when importing resources.
This commit is contained in:
parent
77a236a5e8
commit
ae52e31f17
2 changed files with 92 additions and 2 deletions
|
|
@ -165,6 +165,54 @@ public class ResourceServiceTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
@NotTransactional
|
||||
public void AddResourceWithCriterionSatisfactionsWithIncorrectNames() {
|
||||
|
||||
/* Create a criterion type. */
|
||||
CriterionType ct = createCriterionType();
|
||||
|
||||
/* Create a machine DTO. */
|
||||
MachineDTO machineDTO = new MachineDTO(getUniqueName(), "name", "desc");
|
||||
|
||||
/* Test. */
|
||||
machineDTO.criterionSatisfactions.add( // Non-existent criterion type.
|
||||
new CriterionSatisfactionDTO(ct.getName() + 'X' , "c1",
|
||||
Calendar.getInstance().getTime(), null));
|
||||
assertOneConstraintViolation(
|
||||
resourceService.addResources(createResourceListDTO(machineDTO)));
|
||||
assertFalse(machineDAO.existsMachineWithCodeInAnotherTransaction(
|
||||
machineDTO.code));
|
||||
|
||||
machineDTO.criterionSatisfactions.clear();
|
||||
machineDTO.criterionSatisfactions.add( // Non-existent criterion.
|
||||
new CriterionSatisfactionDTO(ct.getName() , "c1" + 'X',
|
||||
Calendar.getInstance().getTime(), null));
|
||||
assertOneConstraintViolation(
|
||||
resourceService.addResources(createResourceListDTO(machineDTO)));
|
||||
assertFalse(machineDAO.existsMachineWithCodeInAnotherTransaction(
|
||||
machineDTO.code));
|
||||
|
||||
machineDTO.criterionSatisfactions.clear();
|
||||
machineDTO.criterionSatisfactions.add( // Criterion type null.
|
||||
new CriterionSatisfactionDTO(null , "c1",
|
||||
Calendar.getInstance().getTime(), null));
|
||||
assertOneConstraintViolation(
|
||||
resourceService.addResources(createResourceListDTO(machineDTO)));
|
||||
assertFalse(machineDAO.existsMachineWithCodeInAnotherTransaction(
|
||||
machineDTO.code));
|
||||
|
||||
machineDTO.criterionSatisfactions.clear();
|
||||
machineDTO.criterionSatisfactions.add( // Criterion null.
|
||||
new CriterionSatisfactionDTO(ct.getName() , null,
|
||||
Calendar.getInstance().getTime(), null));
|
||||
assertOneConstraintViolation(
|
||||
resourceService.addResources(createResourceListDTO(machineDTO)));
|
||||
assertFalse(machineDAO.existsMachineWithCodeInAnotherTransaction(
|
||||
machineDTO.code));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@NotTransactional
|
||||
public void testAddResourceWithCriterionSatisfactionsWithoutStartDate() {
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
<machine code="m2" name="m2-name" description="m2-desc">
|
||||
<criterion-satisfaction-list>
|
||||
<criterion-satisfaction
|
||||
criterion-type-name=" WORK_RELATIONSHIP "
|
||||
criterion-name=" hiredResourceWorkingRelationship "
|
||||
criterion-type-name="WORK_RELATIONSHIP"
|
||||
criterion-name="hiredResourceWorkingRelationship"
|
||||
start-date="2009-01-01"
|
||||
finish-date=""/>
|
||||
</criterion-satisfaction-list>
|
||||
|
|
@ -52,4 +52,46 @@
|
|||
</criterion-satisfaction-list>
|
||||
</worker>
|
||||
|
||||
<!-- Non-existent criterion type. -->
|
||||
<worker first-name="w3-firstName" surname="w3-surname" nif=" w3-nif ">
|
||||
<criterion-satisfaction-list>
|
||||
<criterion-satisfaction
|
||||
criterion-type-name="WORK_RELATIONSHIP_XXX"
|
||||
criterion-name="hiredResourceWorkingRelationship"
|
||||
start-date="2009-01-01"
|
||||
finish-date=""/>
|
||||
</criterion-satisfaction-list>
|
||||
</worker>
|
||||
|
||||
<!-- Non-existent criterion. -->
|
||||
<worker first-name="w4-firstName" surname="w4-surname" nif=" w4-nif ">
|
||||
<criterion-satisfaction-list>
|
||||
<criterion-satisfaction
|
||||
criterion-type-name="WORK_RELATIONSHIP"
|
||||
criterion-name="hiredResourceWorkingRelationshipXXX"
|
||||
start-date="2009-01-01"
|
||||
finish-date=""/>
|
||||
</criterion-satisfaction-list>
|
||||
</worker>
|
||||
|
||||
<!-- Criterion not specified. -->
|
||||
<worker first-name="w5-firstName" surname="w5-surname" nif=" w5-nif ">
|
||||
<criterion-satisfaction-list>
|
||||
<criterion-satisfaction
|
||||
criterion-type-name="WORK_RELATIONSHIP"
|
||||
start-date="2009-01-01"
|
||||
finish-date=""/>
|
||||
</criterion-satisfaction-list>
|
||||
</worker>
|
||||
|
||||
<!-- Criterion type not specified. -->
|
||||
<worker first-name="w6-firstName" surname="w6-surname" nif=" w6-nif ">
|
||||
<criterion-satisfaction-list>
|
||||
<criterion-satisfaction
|
||||
criterion-name="hiredResourceWorkingRelationship"
|
||||
start-date="2009-01-01"
|
||||
finish-date=""/>
|
||||
</criterion-satisfaction-list>
|
||||
</worker>
|
||||
|
||||
</resource-list>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue