@Test public void testRule4() throws CsvErrorsExceededException { InputStream stream = new StringStream("att,date\natt,"); Result<ObjetRule345> objets = rule345Engine.parseInputStream(stream, ObjetRule345.class); assertTrue(objets.getErrors().isEmpty()); assertEquals(1, objets.getObjects().size()); ObjetRule345 objet = objets.getObjects().get(0); assertEquals("att", objet.att); assertNull(objet.date); }
@Test public void testRule5() throws CsvErrorsExceededException { InputStream stream = new StringStream("att,date\natt,21/12/2012"); Result<ObjetRule345> objets = rule345Engine.parseInputStream(stream, ObjetRule345.class); assertTrue(objets.getErrors().isEmpty()); assertEquals(1, objets.getObjects().size()); ObjetRule345 objet = objets.getObjects().get(0); assertEquals("att", objet.att); assertEquals("21/12/2012", new SimpleDateFormat("dd/MM/yyyy").format(objet.date)); StringWriter writer = new StringWriter(); rule345Engine.writeFile(writer, objets.getObjects(), ObjetRule345.class); assertEquals("\"att\",\"date\"\n\"att\",\"21/12/2012\"\n", writer.getBuffer().toString()); }