### Question:
LineRegisterCommand implements Command { protected void write(StringWriter buffer, VehicleJourney vehicleJourney, StopPoint stopPoint, VehicleJourneyAtStop vehicleJourneyAtStop) throws IOException { DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); buffer.write(vehicleJourney.getId().toString()); buffer.append(SEP); buffer.write(stopPoint.getId().toString()); buffer.append(SEP); if (vehicleJourneyAtStop.getArrivalTime() != null) buffer.write(timeFormat.format(vehicleJourneyAtStop.getArrivalTime())); else buffer.write(NULL); buffer.append(SEP); if (vehicleJourneyAtStop.getDepartureTime() != null) buffer.write(timeFormat.format(vehicleJourneyAtStop.getDepartureTime())); else buffer.write(NULL); buffer.append(SEP); buffer.write(Integer.toString(vehicleJourneyAtStop.getArrivalDayOffset())); buffer.append(SEP); buffer.write(Integer.toString(vehicleJourneyAtStop.getDepartureDayOffset())); buffer.append('\n'); }  @Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) boolean execute(Context context); static final String COMMAND; }### Answer:
@SuppressWarnings("deprecation") @Test (groups = { "write" }, description = "write command") public void testLineRegisterWrite() throws Exception { InitialContext initialContext = new InitialContext(); Context context = new Context(); context.put(INITIAL_CONTEXT, initialContext); StringWriter buffer = new StringWriter(); VehicleJourney neptuneObject = new VehicleJourney(); neptuneObject.setId(4321L); StopPoint sp = new StopPoint(); sp.setId(1001L); VehicleJourneyAtStop vjas = new VehicleJourneyAtStop(); vjas.setStopPoint(sp); vjas.setArrivalTime(new Time(23,59,0)); vjas.setDepartureTime(new Time(0,5,0)); vjas.setArrivalDayOffset(0); vjas.setDepartureDayOffset(1); lineRegister = new LineRegisterCommand(); lineRegister.write(buffer, neptuneObject, sp, vjas); Assert.assertEquals(buffer.toString(), "4321|1001|23:59:00|00:05:00|0|1\n", "Invalid data entry for buffer"); }