/** Positive test to move a TransportUnit. */ @Test public final void testMoveTransportUnit() { TransportUnit transportUnit = transportService.create(new Barcode("4711"), transportUnitType, locationPk); assertNotNull("TransportService must create a new TransportUnit", transportUnit); assertEquals( "The actual Location of the TransportUnit must be preset", locationPk, transportUnit.getActualLocation().getLocationId()); transportService.moveTransportUnit(transportUnit.getBarcode(), targetLocationPk); assertEquals( "The actual Location of the TransportUnit must be changed", targetLocationPk, transportUnit.getActualLocation().getLocationId()); }
/** Negative test to create a new TransportUnit that already exists. */ @Test public final void testCreateExistingTransportUnit() { try { transportService.create(new Barcode("KNOWN"), transportUnitType, locationPk); fail("Must throw a ServiceException while trying to create an already known TransportUnit"); } catch (ServiceRuntimeException se) { LOGGER.debug( "OK:ServiceException expected while trying to create an already known TransportUnit"); } }
/** Test to create a new TransportUnit that already exists. */ @Test public final void testMoveUnknownTransportUnit() { try { transportService.moveTransportUnit(new Barcode("TEST"), targetLocationPk); fail( "Must throw a ServiceException while trying to create a TransportUnit with unknown Barcode"); } catch (ServiceRuntimeException se) { LOGGER.debug( "OK:ServiceException expected while trying to create a TransportUnit with unknown Barcode"); } }
/** Negative test to create a new TransportUnit on a Location that does not exist. */ @Test public final void testCreateTransportUnitOnUnknownLocation() { try { transportService.create( new Barcode("4711"), transportUnitType, new LocationPK("UNKN", "UNKN", "UNKN", "UNKN", "UNKN")); fail( "Must throw a ServiceException while trying to create a TransportUnit with an unknown actual Location"); } catch (ServiceRuntimeException se) { LOGGER.debug( "OK:ServiceException expected while trying to create a TransportUnit with an unknown actual Location"); } }
/** Positive test to create a new TransportUnit. */ @Test public final void testCreateTransportUnit() { TransportUnit transportUnit = transportService.create(new Barcode("4711"), transportUnitType, locationPk); assertNotNull("TransportService must create a new TransportUnit", transportUnit); }