### Question:
ChargingLine implements Importable { void appendImportLog(final String msg){ final String prefix = clockService.nowAsLocalDateTime().toString("yyyy-MM-dd HH:mm:ss") + " "; String nwContent = prefix; if (getImportLog()!=null) { nwContent = nwContent.concat(msg).concat(" ").concat(getImportLog()); } else { nwContent = nwContent.concat(msg); } if (nwContent.length()>254) { nwContent = nwContent.substring(0,254); } setImportLog(nwContent); } ChargingLine(); String title(); @PropertyLayout(hidden = Where.PARENTED_TABLES) Lease getLease(); LeaseItem getLeaseItem(); @Action(semantics = SemanticsOf.NON_IDEMPOTENT) ImportStatus apply(); boolean hideApply(); @Action(semantics = SemanticsOf.IDEMPOTENT) ChargingLine discard(); boolean hideDiscard(); @Action(semantics = SemanticsOf.IDEMPOTENT) ChargingLine noUpdate(); boolean hideNoUpdate(); @Programmatic List<Object> importChargingLine(final boolean nonDiscardedOnly); @Override @Programmatic List<Object> importData(final Object previousRow);  }### Answer:
@Test public void append_import_log_works() throws Exception { ChargingLine line = new ChargingLine(); line.clockService = mockClockService; line.setImportLog("first message"); context.checking(new Expectations(){{ allowing(mockClockService).nowAsLocalDateTime(); will(returnValue(LocalDateTime.parse("2018-01-01"))); }}); line.appendImportLog("second message"); Assertions.assertThat(line.getImportLog()).isEqualTo("2018-01-01 00:00:00 second message first message"); String stringOf254Chars = ""; for (int i=0; i<254; i++ ){ stringOf254Chars = stringOf254Chars.concat("X"); } line.setImportLog(stringOf254Chars); Assertions.assertThat(line.getImportLog().length()).isEqualTo(254); line.appendImportLog("second message"); Assertions.assertThat(line.getImportLog().length()).isEqualTo(254); Assertions.assertThat(line.getImportLog()).startsWith("2018-01-01 00:00:00 second message XXX"); line.setImportLog(null); line.appendImportLog("some message"); Assertions.assertThat(line.getImportLog()).isEqualTo("2018-01-01 00:00:00 some message"); }