@Test public void testDelegate() throws Exception { mapper.setDelegate( new FieldSetMapper<String>() { @Override public String mapFieldSet(FieldSet fs) { return "foo"; } }); assertEquals("foo", mapper.mapFieldSet(new DefaultFieldSet(new String[] {"FOO"})).getItem()); }
@Test public void testMandatoryProperties() throws Exception { try { mapper.afterPropertiesSet(); fail("Expected IllegalArgumentException"); } catch (IllegalArgumentException e) { // expected } }
@Test public void testSetEndRecord() throws Exception { mapper.setEnd("FOO"); assertTrue(mapper.mapFieldSet(new DefaultFieldSet(new String[] {"FOO"})).isFooter()); }
@Test public void testDefaultEndRecord() throws Exception { assertFalse(mapper.mapFieldSet(new DefaultFieldSet(new String[] {"END"})).isHeader()); assertTrue(mapper.mapFieldSet(new DefaultFieldSet(new String[] {"END"})).isFooter()); }