|
|
@@ -25,6 +25,47 @@ class PhaseTest {
|
|
|
assertEquals(Duration.ZERO, phase.getDuration());
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ void testCollatedDurationSumsStepDurations() {
|
|
|
+ final Phase phase = new Phase();
|
|
|
+ final Step step = new Step();
|
|
|
+ step.setDuration(new Duration("10 s"));
|
|
|
+ phase.getCooking().add(step);
|
|
|
+ phase.getCooking().add(step);
|
|
|
+
|
|
|
+ assertEquals(new Duration("20 s"), phase.getCollatedDuration().totalTime);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void testCollatedDurationIgnoresPrepIfNoPrepIngredients() {
|
|
|
+ final Phase phase = new Phase();
|
|
|
+ phase.getPreparation().setDuration(new Duration("15 s"));
|
|
|
+ final Step step = new Step();
|
|
|
+ step.setDuration(new Duration("10 s"));
|
|
|
+ phase.getCooking().add(step);
|
|
|
+
|
|
|
+ assertEquals(Duration.ZERO, phase.getCollatedDuration().prepTime);
|
|
|
+ assertEquals(new Duration("10 s"), phase.getCollatedDuration().totalTime);
|
|
|
+
|
|
|
+ step.getIngredients().add(new Ingredient("", "-", new Amount("1 ct")));
|
|
|
+ assertEquals(new Duration("15 s"), phase.getCollatedDuration().prepTime);
|
|
|
+ assertEquals(new Duration("25 s"), phase.getCollatedDuration().totalTime);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ void testCollatedDurationIgnoresRestIfWhereIsNone() {
|
|
|
+ final Phase phase = new Phase();
|
|
|
+ phase.getRest().setDuration(new Duration("15 s"));
|
|
|
+ final Step step = new Step();
|
|
|
+ step.setDuration(new Duration("10 s"));
|
|
|
+ phase.getCooking().add(step);
|
|
|
+
|
|
|
+ assertEquals(new Duration("10 s"), phase.getCollatedDuration().totalTime);
|
|
|
+
|
|
|
+ phase.getRest().setWhere(Rest.Where.REFRIGERATOR);
|
|
|
+ assertEquals(new Duration("25 s"), phase.getCollatedDuration().totalTime);
|
|
|
+ }
|
|
|
+
|
|
|
@Test
|
|
|
void testSumsTogetherStepDurations() {
|
|
|
final Phase phase = new Phase();
|