@Test public void testImmutableDate() { Date now = new Date(); TransactionStoppedEvent event = new TransactionStoppedEvent( CHARGING_STATION_ID, TRANSACTION_ID, IDENTIFYING_TOKEN, METER_STOP, now, NULL_USER_IDENTITY_CONTEXT); event.getTimestamp().setTime(TWO_MINUTES_AGO.getTime()); assertEquals(now, event.getTimestamp()); }
@Test public void constructorSetsFields() { TransactionStoppedEvent event = new TransactionStoppedEvent( CHARGING_STATION_ID, TRANSACTION_ID, IDENTIFYING_TOKEN, METER_STOP, FIVE_MINUTES_AGO, NULL_USER_IDENTITY_CONTEXT); assertEquals(CHARGING_STATION_ID, event.getChargingStationId()); assertEquals(TRANSACTION_ID, event.getTransactionId()); assertEquals(IDENTIFYING_TOKEN, event.getIdTag()); assertEquals(METER_STOP, event.getMeterStop()); assertEquals(FIVE_MINUTES_AGO, event.getTimestamp()); assertEquals(NULL_USER_IDENTITY_CONTEXT, event.getIdentityContext()); }