List of usage examples for java.lang NoSuchMethodException fillInStackTrace
public synchronized Throwable fillInStackTrace()
From source file:org.callimachusproject.webdriver.helpers.BrowserFunctionalTestCase.java
@Override public void runTest() throws Throwable { Method runMethod = null;//w w w .j a va2 s . c om try { runMethod = this.getClass().getMethod(getMethodName(), (Class[]) null); } catch (NoSuchMethodException e) { fail("Method \"" + getMethodName() + "\" not found"); } if (!Modifier.isPublic(runMethod.getModifiers())) { fail("Method \"" + getMethodName() + "\" should be public"); } try { runMethod.invoke(this, (Object[]) new Class[0]); } catch (InvocationTargetException e) { e.fillInStackTrace(); throw e.getTargetException(); } catch (IllegalAccessException e) { e.fillInStackTrace(); throw e; } }
From source file:org.exoplatform.social.addons.test.AbstractCoreTest.java
@Override /**/* ww w. j a v a2 s . co m*/ * Override to run the test and assert its state. * @throws Throwable if any exception is thrown */ protected void runTest() throws Throwable { String fName = getName(); assertNotNull("TestCase.fName cannot be null", fName); // Some VMs crash when calling getMethod(null,null); Method runMethod = null; try { // use getMethod to get all public inherited // methods. getDeclaredMethods returns all // methods of this class but excludes the // inherited ones. runMethod = getClass().getMethod(fName, (Class[]) null); } catch (NoSuchMethodException e) { fail("Method \"" + fName + "\" not found"); } if (!Modifier.isPublic(runMethod.getModifiers())) { fail("Method \"" + fName + "\" should be public"); } try { MaxQueryNumber queryNumber = runMethod.getAnnotation(MaxQueryNumber.class); if (queryNumber != null) { wantCount = true; maxQuery = queryNumber.value(); } runMethod.invoke(this); } catch (InvocationTargetException e) { e.fillInStackTrace(); throw e.getTargetException(); } catch (IllegalAccessException e) { e.fillInStackTrace(); throw e; } if (hasByteMan) { if (wantCount && count > maxQuery) { throw new AssertionFailedError( "" + count + " JDBC queries was executed but the maximum is : " + maxQuery); } } }
From source file:org.exoplatform.social.core.test.AbstractCoreTest.java
@Override /**/*from ww w . ja v a2 s . c om*/ * Override to run the test and assert its state. * @throws Throwable if any exception is thrown */ protected void runTest() throws Throwable { String fName = getName(); assertNotNull("TestCase.fName cannot be null", fName); // Some VMs crash when calling getMethod(null,null); Method runMethod = null; try { // use getMethod to get all public inherited // methods. getDeclaredMethods returns all // methods of this class but excludes the // inherited ones. runMethod = getClass().getMethod(fName, (Class[]) null); } catch (NoSuchMethodException e) { fail("Method \"" + fName + "\" not found"); } if (!Modifier.isPublic(runMethod.getModifiers())) { fail("Method \"" + fName + "\" should be public"); } try { MaxQueryNumber queryNumber = runMethod.getAnnotation(MaxQueryNumber.class); if (queryNumber != null) { wantCount = true; maxQuery = queryNumber.value(); } runMethod.invoke(this); } catch (InvocationTargetException e) { e.fillInStackTrace(); throw e.getTargetException(); } catch (IllegalAccessException e) { e.fillInStackTrace(); throw e; } if (wantCount && count > maxQuery) { throw new AssertionFailedError( "" + count + " JDBC queries was executed but the maximum is : " + maxQuery); } }