public SpyClosedException(String s, StackTraceElement[] closeStackTrace) { super(ExceptionUtil.generateMessage(s + StringUtil.LINE_SEPARATOR + "Close stack trace:", closeStackTrace)); this.closeStackTrace = closeStackTrace; }
public static void throwException(Throwable e) { ExceptionUtil.<RuntimeException>throwAny(e); }
public <T> ReflectionFieldCopier(Class<T> clazz, String fieldName) { field = getFieldImpl(clazz, fieldName); }
@Test public void availableField() throws Exception { ReflectionFieldCopier reflectionFieldCopier = new ReflectionFieldCopier(Bean.class, "foo"); assertTrue(reflectionFieldCopier.isAvailable()); Bean bean1 = new Bean("bar"); Bean bean2 = new Bean(); reflectionFieldCopier.copy(bean1, bean2); assertEquals(bean1.foo, bean2.foo); }
public static RuntimeException processException(Throwable e) { if (null != e) { if (e instanceof InvocationTargetException) { throwTargetException((InvocationTargetException) e); } else { throwException(e); } } return new RuntimeException(e); }
public static void throwTargetException(InvocationTargetException ite) { Throwable targetException = ite.getTargetException(); if (null == targetException) { targetException = ite; } throwException(targetException); }
private void copyFromDelegate() { for (ReflectionFieldCopier reflectionFieldCopier : getReflectionFieldCopiers()) { reflectionFieldCopier.copy(delegate, this); } }
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { traceElements = StackTraceExtractor.getTraceForProxiedMethod(method); return null; } }
@Test public void getProcessIDDependsOnWorkingDirectory() throws Exception { System.setProperty(IOUtil.WORKING_DIRECTORY_PROPERTY_NAME, "foo"); resetIOUtilSingletons(); String pid1 = IOUtil.getApplicationId(); System.setProperty(IOUtil.WORKING_DIRECTORY_PROPERTY_NAME, "bar"); resetIOUtilSingletons(); String pid2 = IOUtil.getApplicationId(); assertNotEquals(pid1, pid2); }
@Test public void notAvailableField() throws Exception { ReflectionFieldCopier reflectionFieldCopier = new ReflectionFieldCopier(Bean.class, "baz"); assertFalse(reflectionFieldCopier.isAvailable()); Bean bean1 = new Bean("bar"); Bean bean2 = new Bean(); reflectionFieldCopier.copy(bean1, bean2); assertEquals(null, bean2.foo); }
public static RuntimeException processException(Throwable e) { if (null != e) { if (e instanceof InvocationTargetException) { throwTargetException((InvocationTargetException) e); } else { throwException(e); } } return new RuntimeException(e); }
public Logger getParentLogger() { String message = "getParentLogger() method is not implemented in Sniffy"; if (!ExceptionUtil.throwException("java.sql.SQLFeatureNotSupportedException", message)) { throw new UnsupportedOperationException(message); } return null; }
private void copyToDelegate() { for (ReflectionFieldCopier reflectionFieldCopier : getReflectionFieldCopiers()) { reflectionFieldCopier.copy(this, delegate); } }
public SpyClosedException(String s, StackTraceElement[] closeStackTrace) { super(ExceptionUtil.generateMessage(s + StringUtil.LINE_SEPARATOR + "Close stack trace:", closeStackTrace)); this.closeStackTrace = closeStackTrace; }
public static void throwException(Throwable e) { ExceptionUtil.<RuntimeException>throwAny(e); }
public <T> ReflectionFieldCopier(Class<T> clazz, String fieldName) { field = getFieldImpl(clazz, fieldName); }
public static void throwTargetException(InvocationTargetException ite) { Throwable targetException = ite.getTargetException(); if (null == targetException) { targetException = ite; } throwException(targetException); }
private void copyToDelegate() { for (ReflectionFieldCopier reflectionFieldCopier : getReflectionFieldCopiers()) { reflectionFieldCopier.copy(this, delegate); } }
public Logger getParentLogger() { String message = "getParentLogger() method is not implemented in Sniffy"; if (!ExceptionUtil.throwException("java.sql.SQLFeatureNotSupportedException", message)) { throw new UnsupportedOperationException(message); } return null; }
private void copyFromDelegate() { for (ReflectionFieldCopier reflectionFieldCopier : getReflectionFieldCopiers()) { reflectionFieldCopier.copy(delegate, this); } }