@Test public void testGetColumnMapping() { String[] columnMapping = strat.getColumnMapping(); assertNotNull(columnMapping); assertEquals(0, columnMapping.length); String[] columns = new String[] {"name", "orderNumber", "id"}; strat.setColumnMapping(columns); columnMapping = strat.getColumnMapping(); assertNotNull(columnMapping); assertEquals(3, columnMapping.length); assertArrayEquals(columns, columnMapping); }
@Test public void getColumnNamesWhenEmptyMapping() { strat.setColumnMapping(); assertEquals(null, strat.getColumnName(0)); assertArrayEquals(new String[0], strat.getColumnMapping()); }
@Test public void getColumnNamesWhenNullArray() { strat.setColumnMapping((String[]) null); assertEquals(null, strat.getColumnName(0)); assertEquals(null, strat.getColumnName(1)); assertArrayEquals(new String[0], strat.getColumnMapping()); }
@Test public void getColumnNamesWhenNullColumnName() { String[] columns = {null}; strat.setColumnMapping(columns); assertEquals(null, strat.getColumnName(0)); assertEquals(null, strat.getColumnName(1)); assertArrayEquals(columns, strat.getColumnMapping()); }
@Test public void testGetColumnNamesArray() { strat.setColumnMapping("name", null, "id"); String[] mapping = strat.getColumnMapping(); assertEquals(3, mapping.length); assertEquals("name", mapping[0]); assertEquals(null, mapping[1]); assertEquals("id", mapping[2]); }