|
|
@@ -1,6 +1,12 @@
|
|
1
|
1
|
package se.citerus.dddsample.tracking.core.domain.model.cargo;
|
|
2
|
2
|
|
|
3
|
3
|
import junit.framework.TestCase;
|
|
|
4
|
+import se.citerus.dddsample.tracking.core.domain.model.location.Location;
|
|
|
5
|
+import se.citerus.dddsample.tracking.core.domain.model.shared.HandlingActivity;
|
|
|
6
|
+import se.citerus.dddsample.tracking.core.domain.model.voyage.Voyage;
|
|
|
7
|
+
|
|
|
8
|
+import java.util.Date;
|
|
|
9
|
+
|
|
4
|
10
|
import static org.hamcrest.core.Is.is;
|
|
5
|
11
|
import static org.junit.Assert.assertThat;
|
|
6
|
12
|
import static se.citerus.dddsample.tracking.core.application.util.DateTestUtil.toDate;
|
|
|
@@ -8,15 +14,10 @@ import static se.citerus.dddsample.tracking.core.domain.model.cargo.RoutingStatu
|
|
8
|
14
|
import static se.citerus.dddsample.tracking.core.domain.model.cargo.RoutingStatus.ROUTED;
|
|
9
|
15
|
import static se.citerus.dddsample.tracking.core.domain.model.cargo.TransportStatus.*;
|
|
10
|
16
|
import static se.citerus.dddsample.tracking.core.domain.model.handling.HandlingEvent.Type.*;
|
|
11
|
|
-import se.citerus.dddsample.tracking.core.domain.model.location.Location;
|
|
12
|
17
|
import static se.citerus.dddsample.tracking.core.domain.model.location.SampleLocations.*;
|
|
13
|
|
-import se.citerus.dddsample.tracking.core.domain.model.shared.HandlingActivity;
|
|
14
|
18
|
import static se.citerus.dddsample.tracking.core.domain.model.shared.HandlingActivity.customsIn;
|
|
15
|
19
|
import static se.citerus.dddsample.tracking.core.domain.model.shared.HandlingActivity.loadOnto;
|
|
16
|
20
|
import static se.citerus.dddsample.tracking.core.domain.model.voyage.SampleVoyages.*;
|
|
17
|
|
-import se.citerus.dddsample.tracking.core.domain.model.voyage.Voyage;
|
|
18
|
|
-
|
|
19
|
|
-import java.util.Date;
|
|
20
|
21
|
|
|
21
|
22
|
public class DeliveryTest extends TestCase {
|
|
22
|
23
|
|
|
|
@@ -61,7 +62,7 @@ public class DeliveryTest extends TestCase {
|
|
61
|
62
|
public void testDerivedFromRouteSpecificationAndItinerary() throws Exception {
|
|
62
|
63
|
assertEquals(ROUTED, delivery.routingStatus(itinerary, routeSpecification));
|
|
63
|
64
|
assertEquals(Voyage.NONE, delivery.currentVoyage());
|
|
64
|
|
- assertFalse(delivery.onTheGroundAtDestination(routeSpecification));
|
|
|
65
|
+ assertFalse(delivery.isUnloadedIn(routeSpecification.destination()));
|
|
65
|
66
|
assertEquals(Location.NONE, delivery.lastKnownLocation());
|
|
66
|
67
|
assertEquals(NOT_RECEIVED, delivery.transportStatus());
|
|
67
|
68
|
assertTrue(delivery.lastUpdatedOn().before(new Date()));
|
|
|
@@ -79,7 +80,7 @@ public class DeliveryTest extends TestCase {
|
|
79
|
80
|
assertEquals(IN_PORT, newDelivery.transportStatus());
|
|
80
|
81
|
|
|
81
|
82
|
// Changed on handling and/or (re-)routing
|
|
82
|
|
- assertFalse(newDelivery.onTheGroundAtDestination(routeSpecification));
|
|
|
83
|
+ assertFalse(newDelivery.isUnloadedIn(routeSpecification.destination()));
|
|
83
|
84
|
|
|
84
|
85
|
// Changed on (re-)routing
|
|
85
|
86
|
assertEquals(ROUTED, newDelivery.routingStatus(itinerary, routeSpecification));
|
|
|
@@ -96,7 +97,7 @@ public class DeliveryTest extends TestCase {
|
|
96
|
97
|
assertEquals(HANGZOU, newDelivery.lastKnownLocation());
|
|
97
|
98
|
assertEquals(ONBOARD_CARRIER, newDelivery.transportStatus());
|
|
98
|
99
|
|
|
99
|
|
- assertFalse(newDelivery.onTheGroundAtDestination(routeSpecification));
|
|
|
100
|
+ assertFalse(newDelivery.isUnloadedIn(routeSpecification.destination()));
|
|
100
|
101
|
|
|
101
|
102
|
assertEquals(ROUTED, newDelivery.routingStatus(itinerary, routeSpecification));
|
|
102
|
103
|
|
|
|
@@ -113,7 +114,7 @@ public class DeliveryTest extends TestCase {
|
|
113
|
114
|
assertEquals(STOCKHOLM, newDelivery.lastKnownLocation());
|
|
114
|
115
|
assertEquals(IN_PORT, newDelivery.transportStatus());
|
|
115
|
116
|
|
|
116
|
|
- assertTrue(newDelivery.onTheGroundAtDestination(routeSpecification));
|
|
|
117
|
+ assertTrue(newDelivery.isUnloadedIn(routeSpecification.destination()));
|
|
117
|
118
|
|
|
118
|
119
|
assertEquals(ROUTED, newDelivery.routingStatus(itinerary, routeSpecification));
|
|
119
|
120
|
|
|
|
@@ -128,7 +129,7 @@ public class DeliveryTest extends TestCase {
|
|
128
|
129
|
assertEquals(STOCKHOLM, newDelivery.lastKnownLocation());
|
|
129
|
130
|
assertEquals(CLAIMED, newDelivery.transportStatus());
|
|
130
|
131
|
|
|
131
|
|
- assertFalse(newDelivery.onTheGroundAtDestination(routeSpecification));
|
|
|
132
|
+ assertFalse(newDelivery.isUnloadedIn(routeSpecification.destination()));
|
|
132
|
133
|
|
|
133
|
134
|
assertEquals(ROUTED, newDelivery.routingStatus(itinerary, routeSpecification));
|
|
134
|
135
|
|
|
|
@@ -146,7 +147,7 @@ public class DeliveryTest extends TestCase {
|
|
146
|
147
|
|
|
147
|
148
|
// Next handling activity is undefined. Need a new itinerary to know what to do.
|
|
148
|
149
|
|
|
149
|
|
- assertFalse(newDelivery.onTheGroundAtDestination(routeSpecification));
|
|
|
150
|
+ assertFalse(newDelivery.isUnloadedIn(routeSpecification.destination()));
|
|
150
|
151
|
|
|
151
|
152
|
assertEquals(ROUTED, newDelivery.routingStatus(itinerary, routeSpecification));
|
|
152
|
153
|
|