|
|
@@ -8,7 +8,6 @@ import static se.citerus.dddsample.tracking.core.domain.model.location.SampleLoc
|
|
8
|
8
|
import static se.citerus.dddsample.tracking.core.domain.model.location.SampleLocations.STOCKHOLM;
|
|
9
|
9
|
import se.citerus.dddsample.tracking.core.domain.model.location.UnLocode;
|
|
10
|
10
|
import se.citerus.dddsample.tracking.core.domain.service.RoutingService;
|
|
11
|
|
-import se.citerus.dddsample.tracking.core.domain.service.TrackingIdGenerator;
|
|
12
|
11
|
|
|
13
|
12
|
import java.util.Date;
|
|
14
|
13
|
|
|
|
@@ -18,14 +17,14 @@ public class BookingServiceTest extends TestCase {
|
|
18
|
17
|
CargoRepository cargoRepository;
|
|
19
|
18
|
LocationRepository locationRepository;
|
|
20
|
19
|
RoutingService routingService;
|
|
21
|
|
- TrackingIdGenerator trackingIdGenerator;
|
|
|
20
|
+ TrackingIdFactory trackingIdFactory;
|
|
22
|
21
|
|
|
23
|
22
|
protected void setUp() throws Exception {
|
|
24
|
23
|
cargoRepository = createMock(CargoRepository.class);
|
|
25
|
24
|
locationRepository = createMock(LocationRepository.class);
|
|
26
|
25
|
routingService = createMock(RoutingService.class);
|
|
27
|
|
- trackingIdGenerator = createMock(TrackingIdGenerator.class);
|
|
28
|
|
- CargoFactory cargoFactory = new CargoFactory(locationRepository, trackingIdGenerator);
|
|
|
26
|
+ trackingIdFactory = createMock(TrackingIdFactory.class);
|
|
|
27
|
+ CargoFactory cargoFactory = new CargoFactory(locationRepository, trackingIdFactory);
|
|
29
|
28
|
bookingService = new BookingServiceImpl(routingService, cargoFactory, cargoRepository, locationRepository);
|
|
30
|
29
|
}
|
|
31
|
30
|
|
|
|
@@ -34,19 +33,19 @@ public class BookingServiceTest extends TestCase {
|
|
34
|
33
|
UnLocode fromUnlocode = new UnLocode("USCHI");
|
|
35
|
34
|
UnLocode toUnlocode = new UnLocode("SESTO");
|
|
36
|
35
|
|
|
37
|
|
- expect(trackingIdGenerator.nextTrackingId()).andReturn(expectedTrackingId);
|
|
|
36
|
+ expect(trackingIdFactory.nextTrackingId()).andReturn(expectedTrackingId);
|
|
38
|
37
|
expect(locationRepository.find(fromUnlocode)).andReturn(CHICAGO);
|
|
39
|
38
|
expect(locationRepository.find(toUnlocode)).andReturn(STOCKHOLM);
|
|
40
|
39
|
|
|
41
|
40
|
cargoRepository.store(isA(Cargo.class));
|
|
42
|
41
|
|
|
43
|
|
- replay(cargoRepository, locationRepository, trackingIdGenerator);
|
|
|
42
|
+ replay(cargoRepository, locationRepository, trackingIdFactory);
|
|
44
|
43
|
|
|
45
|
44
|
TrackingId trackingId = bookingService.bookNewCargo(fromUnlocode, toUnlocode, new Date());
|
|
46
|
45
|
assertEquals(expectedTrackingId, trackingId);
|
|
47
|
46
|
}
|
|
48
|
47
|
|
|
49
|
48
|
protected void tearDown() throws Exception {
|
|
50
|
|
- verify(cargoRepository, locationRepository, trackingIdGenerator);
|
|
|
49
|
+ verify(cargoRepository, locationRepository, trackingIdFactory);
|
|
51
|
50
|
}
|
|
52
|
51
|
}
|