소스 검색

Minor validation fixes and toString changes in Leg, fixed LegTest exception expectation

peter_backlund 17 년 전
부모
커밋
d0e8723d17

+ 3
- 1
dddsample/src/main/java/se/citerus/dddsample/domain/model/cargo/Leg.java 파일 보기

25
     Validate.notNull(voyage, "Voyage is required");
25
     Validate.notNull(voyage, "Voyage is required");
26
     Validate.notNull(loadLocation, "Load location is required");
26
     Validate.notNull(loadLocation, "Load location is required");
27
     Validate.notNull(unloadLocation, "Unload location is required");
27
     Validate.notNull(unloadLocation, "Unload location is required");
28
+    Validate.notNull(loadTime, "Load time is required");
29
+    Validate.notNull(unloadTime, "Unload time is required");
28
     Validate.isTrue(!loadLocation.sameIdentityAs(unloadLocation));
30
     Validate.isTrue(!loadLocation.sameIdentityAs(unloadLocation));
29
     // TODO use a minimum time between unloading and loading?
31
     // TODO use a minimum time between unloading and loading?
30
     Validate.isTrue(unloadTime.after(loadTime));
32
     Validate.isTrue(unloadTime.after(loadTime));
118
   @Override
120
   @Override
119
   public String toString() {
121
   public String toString() {
120
     return "Load in " + loadLocation + " at " + loadTime +
122
     return "Load in " + loadLocation + " at " + loadTime +
121
-      ", unload in " + unloadLocation + " at " + unloadTime;
123
+      " --- Unload in " + unloadLocation + " at " + unloadTime;
122
   }
124
   }
123
 
125
 
124
   Leg() {
126
   Leg() {

+ 1
- 1
dddsample/src/test/java/se/citerus/dddsample/domain/model/cargo/LegTest.java 파일 보기

11
 
11
 
12
   final Voyage voyage = NEW_YORK_TO_DALLAS;
12
   final Voyage voyage = NEW_YORK_TO_DALLAS;
13
 
13
 
14
-  @Test(expected = IllegalArgumentException.class)
14
+  @Test(expected = NullPointerException.class)
15
   public void testConstructor() throws Exception {
15
   public void testConstructor() throws Exception {
16
     Leg.deriveLeg(null, null, null);
16
     Leg.deriveLeg(null, null, null);
17
   }
17
   }