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