| 123456789101112131415161718192021222324252627282930313233 |
- package org.leumasjaffe.recipe.model;
- import static org.junit.jupiter.api.Assertions.*;
- import static org.leumasjaffe.recipe.model.Duration.Display.*;
- import org.junit.jupiter.api.Test;
- class CollatedDurationTest {
- @Test
- void testAddZeroIsSelf() {
- final CollatedDuration collate = new CollatedDuration(
- new Duration(SECONDS, 0, 10), new Duration(SECONDS, 0, 20),
- new Duration(SECONDS, 0, 60));
-
- assertEquals(collate, collate.plus(CollatedDuration.ZERO));
- assertEquals(collate, CollatedDuration.ZERO.plus(collate));
- }
-
- @Test
- void testAddsElementsSeparately() {
- final CollatedDuration collate = new CollatedDuration(
- new Duration(SECONDS, 0, 10), new Duration(SECONDS, 0, 20),
- new Duration(SECONDS, 0, 60));
- final CollatedDuration expected = new CollatedDuration(
- new Duration(SECONDS, 0, 20), new Duration(SECONDS, 0, 40),
- new Duration(SECONDS, 0, 120));
- assertEquals(expected, collate.plus(collate));
- }
- }
|