Skip to content
This repository has been archived by the owner on Nov 29, 2024. It is now read-only.

Commit

Permalink
test for values instead of objects
Browse files Browse the repository at this point in the history
  • Loading branch information
kt86 committed Aug 16, 2024
1 parent 1293b86 commit 37d94ef
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,29 +192,35 @@ public void testCollectionLSPScheduling() {
assertEquals(2, shipment.getSimulationTrackers().size());
ArrayList<EventHandler> eventHandlers = new ArrayList<>(shipment.getSimulationTrackers());

{
assertInstanceOf(LSPTourEndEventHandler.class, eventHandlers.getFirst());
LSPTourEndEventHandler endHandler = (LSPTourEndEventHandler) eventHandlers.getFirst();
assertSame(endHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(endHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(endHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(endHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(endHandler.getLogisticChainElement(), planElements.get(2).getLogisticChainElement());
assertSame(endHandler.getLogisticChainElement(), collectionLSP.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements().iterator().next());
assertSame(endHandler.getLspShipment(), shipment);
assertSame(endHandler.getResourceId(), planElements.get(2).getResourceId());
assertSame(endHandler.getResourceId(), collectionLSP.getResources().iterator().next().getId());
}

{
assertInstanceOf(CollectionServiceEndEventHandler.class, eventHandlers.get(1));
CollectionServiceEndEventHandler serviceHandler = (CollectionServiceEndEventHandler) eventHandlers.get(1);
assertSame(serviceHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(serviceHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(serviceHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(serviceHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(serviceHandler.getElement(), planElements.get(1).getLogisticChainElement());
assertSame(serviceHandler.getElement(), collectionLSP.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements().iterator().next());
assertSame(serviceHandler.getLspShipment(), shipment);
assertSame(serviceHandler.getResourceId(), planElements.get(1).getResourceId());
assertSame(serviceHandler.getResourceId(), collectionLSP.getResources().iterator().next().getId());
}
}

for (LogisticChain solution : collectionLSP.getSelectedPlan().getLogisticChains()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,8 @@ public void testCompletedLSPScheduling() {
assertSame(endHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(endHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(endHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(endHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(endHandler.getLogisticChainElement(), planElements.get(0).getLogisticChainElement());
assertSame(endHandler.getLogisticChainElement(), planElements.get(1).getLogisticChainElement());
assertSame(endHandler.getLogisticChainElement(), planElements.get(2).getLogisticChainElement());
Expand All @@ -505,7 +506,8 @@ public void testCompletedLSPScheduling() {
assertSame(serviceHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(serviceHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(serviceHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(serviceHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(serviceHandler.getElement(), planElements.get(0).getLogisticChainElement());
assertSame(serviceHandler.getElement(), planElements.get(1).getLogisticChainElement());
assertSame(serviceHandler.getElement(), planElements.get(2).getLogisticChainElement());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,8 @@ public void testFirstReloadLSPScheduling() {
assertSame(endHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(endHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(endHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(endHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(endHandler.getLogisticChainElement(), planElements.get(2).getLogisticChainElement());
assertSame(endHandler.getLogisticChainElement(), lsp.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements().iterator().next());
assertSame(endHandler.getLspShipment(), shipment);
Expand All @@ -297,7 +298,8 @@ public void testFirstReloadLSPScheduling() {
assertSame(serviceHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(serviceHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(serviceHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(serviceHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(serviceHandler.getElement(), planElements.getFirst().getLogisticChainElement());
assertSame(serviceHandler.getElement(), lsp.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements().iterator().next());
assertSame(serviceHandler.getLspShipment(), shipment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ public void testMainRunLSPScheduling() {
assertSame(endHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(endHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(endHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(endHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(endHandler.getLogisticChainElement(), planElements.get(0).getLogisticChainElement());
assertSame(endHandler.getLogisticChainElement(), planElements.get(1).getLogisticChainElement());
assertSame(endHandler.getLogisticChainElement(), planElements.get(2).getLogisticChainElement());
Expand All @@ -370,7 +371,8 @@ public void testMainRunLSPScheduling() {
assertSame(serviceHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(serviceHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(serviceHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(serviceHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(serviceHandler.getElement(), planElements.get(0).getLogisticChainElement());
assertSame(serviceHandler.getElement(), planElements.get(1).getLogisticChainElement());
assertSame(serviceHandler.getElement(), planElements.get(2).getLogisticChainElement());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ public void testCollectionLSPScheduling() {
assertSame(endHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(endHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(endHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(endHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(endHandler.getLogisticChainElement(), planElements.get(2).getLogisticChainElement());
assertSame(endHandler.getLogisticChainElement(), collectionLSP.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements().iterator().next());
assertSame(endHandler.getLspShipment(), shipment);
Expand All @@ -212,7 +213,8 @@ public void testCollectionLSPScheduling() {
assertSame(serviceHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(serviceHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(serviceHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(serviceHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(serviceHandler.getElement(), planElements.get(1).getLogisticChainElement());
assertSame(serviceHandler.getElement(), collectionLSP.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements().iterator().next());
assertSame(serviceHandler.getLspShipment(), shipment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,8 @@ public void testCompletedLSPScheduling() {
assertSame(endHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(endHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(endHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(endHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(endHandler.getLogisticChainElement(), planElements.get(0).getLogisticChainElement());
assertSame(endHandler.getLogisticChainElement(), planElements.get(1).getLogisticChainElement());
assertSame(endHandler.getLogisticChainElement(), planElements.get(2).getLogisticChainElement());
Expand All @@ -508,7 +509,8 @@ public void testCompletedLSPScheduling() {
assertSame(serviceHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(serviceHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(serviceHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(serviceHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(serviceHandler.getElement(), planElements.get(0).getLogisticChainElement());
assertSame(serviceHandler.getElement(), planElements.get(1).getLogisticChainElement());
assertSame(serviceHandler.getElement(), planElements.get(2).getLogisticChainElement());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ public void testFirstReloadLSPScheduling() {
assertSame(endHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(endHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(endHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(endHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(endHandler.getLogisticChainElement(), planElements.get(2).getLogisticChainElement());
assertSame(endHandler.getLogisticChainElement(), lsp.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements().iterator().next());
assertSame(endHandler.getLspShipment(), shipment);
Expand All @@ -296,7 +297,8 @@ public void testFirstReloadLSPScheduling() {
assertSame(serviceHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(serviceHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(serviceHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(serviceHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(serviceHandler.getElement(), planElements.getFirst().getLogisticChainElement());
assertSame(serviceHandler.getElement(), lsp.getSelectedPlan().getLogisticChains().iterator().next().getLogisticChainElements().iterator().next());
assertSame(serviceHandler.getLspShipment(), shipment);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,8 @@ public void testMainRunLSPScheduling() {
assertSame(endHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(endHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(endHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(endHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(endHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(endHandler.getLogisticChainElement(), planElements.get(0).getLogisticChainElement());
assertSame(endHandler.getLogisticChainElement(), planElements.get(1).getLogisticChainElement());
assertSame(endHandler.getLogisticChainElement(), planElements.get(2).getLogisticChainElement());
Expand All @@ -370,7 +371,8 @@ public void testMainRunLSPScheduling() {
assertSame(serviceHandler.getCarrierService().getLocationLinkId(), shipment.getFrom());
assertEquals(serviceHandler.getCarrierService().getCapacityDemand(), shipment.getSize());
assertEquals(serviceHandler.getCarrierService().getServiceDuration(), shipment.getDeliveryServiceTime(), 0.0);
assertSame(serviceHandler.getCarrierService().getServiceStartTimeWindow(), shipment.getPickupTimeWindow());
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getStart(), shipment.getPickupTimeWindow().getStart(), 0.0);
assertEquals(serviceHandler.getCarrierService().getServiceStartTimeWindow().getEnd(), shipment.getPickupTimeWindow().getEnd(), 0.0);
assertSame(serviceHandler.getElement(), planElements.get(0).getLogisticChainElement());
assertSame(serviceHandler.getElement(), planElements.get(1).getLogisticChainElement());
assertSame(serviceHandler.getElement(), planElements.get(2).getLogisticChainElement());
Expand Down
Loading

0 comments on commit 37d94ef

Please sign in to comment.