示例#1
0
  @Before
  public void setUp() {

    try {
      final Method m = MiniProjet.class.getDeclaredMethod("loadConfigFile", Path.class);
      m.setAccessible(true);
      m.invoke(null, Paths.get(MiniProjet.FOLDER, MiniProjet.CONFIG));

    } catch (IllegalAccessException
        | IllegalArgumentException
        | InvocationTargetException
        | NoSuchMethodException
        | SecurityException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
示例#2
0
 private void invalidValueHelper(Object obj, String methodName, int i) {
   try {
     Method m = obj.getClass().getMethod(methodName, int.class);
     m.invoke(obj, i);
     fail("Didn't cause an invalid value exception.");
   } catch (NoSuchMethodException | SecurityException e) {
     System.err.println("Error when getting the method. Uh oh!");
     e.printStackTrace();
     fail();
   } catch (IllegalAccessException | IllegalArgumentException e) {
     System.err.println("Error when invoking the method. Uh oh!");
     e.printStackTrace();
     fail();
   } catch (InvocationTargetException e) {
     assertEquals(JsonTypeException.class, e.getTargetException().getClass());
   }
 }