<V, T> V createSoftAssertionProxy(Class<V> assertClass, Class<T> actualClass, T actual) { try { Class<? extends V> proxyClass = createSoftAssertionProxyClass(assertClass); Constructor<? extends V> constructor = proxyClass.getConstructor(actualClass); V proxiedAssert = constructor.newInstance(actual); // instance is a AssertJProxySetup since it is a generated proxy implementing it (see createProxy) ((AssertJProxySetup) proxiedAssert).assertj$setup(new ProxifyMethodChangingTheObjectUnderTest(this), collector); return proxiedAssert; } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { throw new RuntimeException(e); } }
IterableSizeAssert<?> createIterableSizeAssertProxy(IterableSizeAssert<?> iterableSizeAssert) { Class<?> proxyClass = createSoftAssertionProxyClass(IterableSizeAssert.class); try { Constructor<?> constructor = proxyClass.getConstructor(AbstractIterableAssert.class, Integer.class); IterableSizeAssert<?> proxiedAssert = (IterableSizeAssert<?>) constructor.newInstance(iterableSizeAssert.returnToIterable(), iterableSizeAssert.actual); ((AssertJProxySetup) proxiedAssert).assertj$setup(new ProxifyMethodChangingTheObjectUnderTest(this), collector); return proxiedAssert; } catch (Exception e) { throw new RuntimeException(e); } }
MapSizeAssert<?, ?> createMapSizeAssertProxy(MapSizeAssert<?, ?> mapSizeAssert) { Class<?> proxyClass = createSoftAssertionProxyClass(MapSizeAssert.class); try { Constructor<?> constructor = proxyClass.getConstructor(AbstractMapAssert.class, Integer.class); MapSizeAssert<?, ?> proxiedAssert = (MapSizeAssert<?, ?>) constructor.newInstance(mapSizeAssert.returnToMap(), mapSizeAssert.actual); ((AssertJProxySetup) proxiedAssert).assertj$setup(new ProxifyMethodChangingTheObjectUnderTest(this), collector); return proxiedAssert; } catch (Exception e) { throw new RuntimeException(e); } }
<V, T> V createSoftAssertionProxy(Class<V> assertClass, Class<T> actualClass, T actual) { try { Class<? extends V> proxyClass = createSoftAssertionProxyClass(assertClass); Constructor<? extends V> constructor = proxyClass.getConstructor(actualClass); V proxiedAssert = constructor.newInstance(actual); // instance is a AssertJProxySetup since it is a generated proxy implementing it (see createProxy) ((AssertJProxySetup) proxiedAssert).assertj$setup(new ProxifyMethodChangingTheObjectUnderTest(this), collector); return proxiedAssert; } catch (NoSuchMethodException | IllegalAccessException | InstantiationException | InvocationTargetException e) { throw new RuntimeException(e); } }
IterableSizeAssert<?> createIterableSizeAssertProxy(IterableSizeAssert<?> iterableSizeAssert) { Class<?> proxyClass = createSoftAssertionProxyClass(IterableSizeAssert.class); try { Constructor<?> constructor = proxyClass.getConstructor(AbstractIterableAssert.class, Integer.class); IterableSizeAssert<?> proxiedAssert = (IterableSizeAssert<?>) constructor.newInstance(iterableSizeAssert.returnToIterable(), iterableSizeAssert.actual); ((AssertJProxySetup) proxiedAssert).assertj$setup(new ProxifyMethodChangingTheObjectUnderTest(this), collector); return proxiedAssert; } catch (Exception e) { throw new RuntimeException(e); } }
MapSizeAssert<?, ?> createMapSizeAssertProxy(MapSizeAssert<?, ?> mapSizeAssert) { Class<?> proxyClass = createSoftAssertionProxyClass(MapSizeAssert.class); try { Constructor<?> constructor = proxyClass.getConstructor(AbstractMapAssert.class, Integer.class); MapSizeAssert<?, ?> proxiedAssert = (MapSizeAssert<?, ?>) constructor.newInstance(mapSizeAssert.returnToMap(), mapSizeAssert.actual); ((AssertJProxySetup) proxiedAssert).assertj$setup(new ProxifyMethodChangingTheObjectUnderTest(this), collector); return proxiedAssert; } catch (Exception e) { throw new RuntimeException(e); } }