|
|
@@ -2,7 +2,7 @@ package se.citerus.dddsample.application;
|
|
2
|
2
|
|
|
3
|
3
|
import junit.framework.TestCase;
|
|
4
|
4
|
import static org.easymock.EasyMock.*;
|
|
5
|
|
-import se.citerus.dddsample.application.event.ApplicationEvents;
|
|
|
5
|
+import se.citerus.dddsample.application.event.SystemEvents;
|
|
6
|
6
|
import se.citerus.dddsample.application.impl.HandlingEventServiceImpl;
|
|
7
|
7
|
import se.citerus.dddsample.domain.model.cargo.Cargo;
|
|
8
|
8
|
import se.citerus.dddsample.domain.model.cargo.CargoRepository;
|
|
|
@@ -20,7 +20,7 @@ import java.util.Date;
|
|
20
|
20
|
|
|
21
|
21
|
public class HandlingEventServiceTest extends TestCase {
|
|
22
|
22
|
private HandlingEventServiceImpl service;
|
|
23
|
|
- private ApplicationEvents applicationEvents;
|
|
|
23
|
+ private SystemEvents systemEvents;
|
|
24
|
24
|
private CargoRepository cargoRepository;
|
|
25
|
25
|
private VoyageRepository voyageRepository;
|
|
26
|
26
|
private HandlingEventRepository handlingEventRepository;
|
|
|
@@ -33,14 +33,14 @@ public class HandlingEventServiceTest extends TestCase {
|
|
33
|
33
|
voyageRepository = createMock(VoyageRepository.class);
|
|
34
|
34
|
handlingEventRepository = createMock(HandlingEventRepository.class);
|
|
35
|
35
|
locationRepository = createMock(LocationRepository.class);
|
|
36
|
|
- applicationEvents = createMock(ApplicationEvents.class);
|
|
|
36
|
+ systemEvents = createMock(SystemEvents.class);
|
|
37
|
37
|
|
|
38
|
38
|
HandlingEventFactory handlingEventFactory = new HandlingEventFactory(cargoRepository, voyageRepository, locationRepository);
|
|
39
|
|
- service = new HandlingEventServiceImpl(handlingEventRepository, applicationEvents, handlingEventFactory);
|
|
|
39
|
+ service = new HandlingEventServiceImpl(handlingEventRepository, systemEvents, handlingEventFactory);
|
|
40
|
40
|
}
|
|
41
|
41
|
|
|
42
|
42
|
protected void tearDown() throws Exception {
|
|
43
|
|
- verify(cargoRepository, voyageRepository, handlingEventRepository, applicationEvents);
|
|
|
43
|
+ verify(cargoRepository, voyageRepository, handlingEventRepository, systemEvents);
|
|
44
|
44
|
}
|
|
45
|
45
|
|
|
46
|
46
|
public void testRegisterEvent() throws Exception {
|
|
|
@@ -48,9 +48,9 @@ public class HandlingEventServiceTest extends TestCase {
|
|
48
|
48
|
expect(voyageRepository.find(CM001.voyageNumber())).andReturn(CM001);
|
|
49
|
49
|
expect(locationRepository.find(STOCKHOLM.unLocode())).andReturn(STOCKHOLM);
|
|
50
|
50
|
handlingEventRepository.store(isA(HandlingEvent.class));
|
|
51
|
|
- applicationEvents.notifyOfHandlingEvent(isA(HandlingEvent.class));
|
|
|
51
|
+ systemEvents.notifyOfHandlingEvent(isA(HandlingEvent.class));
|
|
52
|
52
|
|
|
53
|
|
- replay(cargoRepository, voyageRepository, handlingEventRepository, locationRepository, applicationEvents);
|
|
|
53
|
+ replay(cargoRepository, voyageRepository, handlingEventRepository, locationRepository, systemEvents);
|
|
54
|
54
|
|
|
55
|
55
|
service.registerHandlingEvent(new Date(), cargo.trackingId(), CM001.voyageNumber(), STOCKHOLM.unLocode(), HandlingEvent.Type.LOAD);
|
|
56
|
56
|
}
|