NullColumnParser implements ColumnParser { @Override public void parse(String column, Object t, Method method, String columnFormat) throws IllegalArgumentException, IllegalAccessException, InvocationTargetException { method.invoke(t, column); }  @Override void parse(String column, Object t, Method method,
            String columnFormat);  }
@Test public void testParse01() throws Exception { NullColumnParser nullColumnParser = new NullColumnParser(); String column = "AA"; NullColumnParser_Stub01 t = new NullColumnParser_Stub01(); Method method = NullColumnParser_Stub01.class.getDeclaredMethod("setA", new Class[] { String.class }); String columnFormat = "BB"; nullColumnParser.parse(column, t, method, columnFormat); Object result = ReflectionTestUtils.getField(t, "a"); assertSame(column, result); }
@Test public void testParse02() throws Exception { NullColumnParser nullColumnParser = new NullColumnParser(); String column = "AA"; NullColumnParser_Stub01 t = new NullColumnParser_Stub01(); Method method = NullColumnParser_Stub01.class.getDeclaredMethod( "setAPrivate", new Class[] { String.class }); String columnFormat = "BB"; try { nullColumnParser.parse(column, t, method, columnFormat); fail("IllegalAccessExceptionがスローされませんでした。"); } catch (IllegalAccessException e) { assertEquals(IllegalAccessException.class, e.getClass()); } }
@Test public void testParse03() throws Exception { NullColumnParser nullColumnParser = new NullColumnParser(); String column = "AA"; NullColumnParser_Stub01 t = new NullColumnParser_Stub01(); Method method = NullColumnParser_Stub01.class.getDeclaredMethod( "setAException", new Class[] { String.class }); String columnFormat = "BB"; try { nullColumnParser.parse(column, t, method, columnFormat); fail(); } catch (InvocationTargetException e) { assertEquals(InvocationTargetException.class, e.getClass()); } }
@Test public void testParse04() throws Exception { NullColumnParser nullColumnParser = new NullColumnParser(); String column = "AA"; NullColumnParser_Stub01 t = new NullColumnParser_Stub01(); Method method = NullColumnParser_Stub01.class.getDeclaredMethod( "setAAndB", new Class[] { String.class, String.class }); String columnFormat = "BB"; try { nullColumnParser.parse(column, t, method, columnFormat); fail(); } catch (IllegalArgumentException e) { assertEquals(IllegalArgumentException.class, e.getClass()); } }
@Test public void testParse05() throws Exception { NullColumnParser nullColumnParser = new NullColumnParser(); String column = null; NullColumnParser_Stub01 t = new NullColumnParser_Stub01(); Method method = NullColumnParser_Stub01.class.getDeclaredMethod("setA", new Class[] { String.class }); String columnFormat = null; nullColumnParser.parse(column, t, method, columnFormat); Object result = ReflectionTestUtils.getField(t, "a"); assertNull(result); }
@Test public void testParse06() throws Exception { NullColumnParser nullColumnParser = new NullColumnParser(); String column = "AA"; NullColumnParser_Stub01 t = new NullColumnParser_Stub01(); Method method = NullColumnParser_Stub01.class.getDeclaredMethod("setA", new Class[] { String.class }); String columnFormat = "BB"; nullColumnParser.parse(column, t, method, columnFormat); Object result = ReflectionTestUtils.getField(t, "a"); assertSame(column, result); }