ItEr12S10ProbasModuloRecursosItEr11S13: Fixed bug at Resource#finishEnforcedAt. Changing signature to reflect better its meaning.
This commit is contained in:
parent
9633509dbb
commit
28224f65f3
2 changed files with 9 additions and 11 deletions
|
|
@ -336,14 +336,14 @@ public abstract class Resource {
|
|||
|
||||
public List<CriterionSatisfaction> finish(
|
||||
CriterionWithItsType criterionWithItsType) {
|
||||
return finishEnforcedAt(criterionWithItsType, new Date());
|
||||
return finishEnforcedAt(criterionWithItsType.getCriterion(), new Date());
|
||||
}
|
||||
|
||||
public List<CriterionSatisfaction> finishEnforcedAt(
|
||||
CriterionWithItsType criterionWithItsType, Date date) {
|
||||
public List<CriterionSatisfaction> finishEnforcedAt(Criterion criterion,
|
||||
Date date) {
|
||||
ArrayList<CriterionSatisfaction> result = new ArrayList<CriterionSatisfaction>();
|
||||
for (CriterionSatisfaction criterionSatisfaction : query().from(
|
||||
criterionWithItsType.getType()).at(date).result()) {
|
||||
criterion).at(date).result()) {
|
||||
criterionSatisfaction.finish(date);
|
||||
result.add(criterionSatisfaction);
|
||||
}
|
||||
|
|
@ -368,9 +368,9 @@ public abstract class Resource {
|
|||
|
||||
public boolean canAddSatisfaction(ICriterionType<?> type,
|
||||
CriterionSatisfaction satisfaction) {
|
||||
EnsureSatisfactionIsCorrect ensureSatisfactionIsCorrect = new EnsureSatisfactionIsCorrect(this, type, satisfaction);
|
||||
return ensureSatisfactionIsCorrect
|
||||
.canAddSatisfaction();
|
||||
EnsureSatisfactionIsCorrect ensureSatisfactionIsCorrect = new EnsureSatisfactionIsCorrect(
|
||||
this, type, satisfaction);
|
||||
return ensureSatisfactionIsCorrect.canAddSatisfaction();
|
||||
}
|
||||
|
||||
private CriterionSatisfaction getNext(ICriterionType<?> type,
|
||||
|
|
|
|||
|
|
@ -54,8 +54,7 @@ public class ResourceTest {
|
|||
public void getSatisfactionsForWrongIntervalThrowsException() {
|
||||
Worker worker = new Worker("firstName", "surName", "2333232", 10);
|
||||
worker.query().from(CriterionDAOTest.createValidCriterion())
|
||||
.enforcedInAll(Interval.range(year(2000), year(1999)))
|
||||
.result();
|
||||
.enforcedInAll(Interval.range(year(2000), year(1999))).result();
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
|
|
@ -213,8 +212,7 @@ public class ResourceTest {
|
|||
assertThat(worker.query().from(criterionType).enforcedInAll(fromNow)
|
||||
.result().size(), equalTo(1));
|
||||
List<CriterionSatisfaction> finished = worker.finishEnforcedAt(
|
||||
new CriterionWithItsType(criterionType, criterion), fromNow
|
||||
.getStart());
|
||||
criterion, fromNow.getStart());
|
||||
assertThat(finished.size(), equalTo(1));
|
||||
assertTrue("all satisfactions are finished", worker.query().from(
|
||||
criterionType).enforcedInAll(fromNow).result().isEmpty());
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue