for (Invokable<?, ?> factory : getFactoriesToTest()) { try { testEqualsUsing(factory);
/** * Tests null checks against the instance methods of the return values, if any. * * <p>Test fails if default value cannot be determined for a constructor or factory method * parameter, or if the constructor or factory method throws exception. * * @return this tester */ public FactoryMethodReturnValueTester testNulls() throws Exception { for (Invokable<?, ?> factory : getFactoriesToTest()) { Object instance = instantiate(factory); if (instance != null && packagesToTest.contains(Reflection.getPackageName(instance.getClass()))) { try { nullPointerTester.testAllPublicInstanceMethods(instance); } catch (AssertionError e) { AssertionError error = new AssertionFailedError("Null check failed on return value of " + factory); error.initCause(e); throw error; } } } return this; }
/** * Runs serialization test on the return values of the static methods. * * <p>Test fails if default value cannot be determined for a constructor or factory method * parameter, or if the constructor or factory method throws exception. * * @return this tester */ public FactoryMethodReturnValueTester testSerializable() throws Exception { for (Invokable<?, ?> factory : getFactoriesToTest()) { Object instance = instantiate(factory); if (instance != null) { try { SerializableTester.reserialize(instance); } catch (RuntimeException e) { AssertionError error = new AssertionFailedError("Serialization failed on return value of " + factory); error.initCause(e.getCause()); throw error; } } } return this; }
for (Invokable<?, ?> factory : getFactoriesToTest()) { try { testEqualsUsing(factory);
/** * Tests null checks against the instance methods of the return values, if any. * * <p>Test fails if default value cannot be determined for a constructor or factory method * parameter, or if the constructor or factory method throws exception. * * @return this tester */ public FactoryMethodReturnValueTester testNulls() throws Exception { for (Invokable<?, ?> factory : getFactoriesToTest()) { Object instance = instantiate(factory); if (instance != null && packagesToTest.contains(Reflection.getPackageName(instance.getClass()))) { try { nullPointerTester.testAllPublicInstanceMethods(instance); } catch (AssertionError e) { AssertionError error = new AssertionFailedError( "Null check failed on return value of " + factory); error.initCause(e); throw error; } } } return this; }
for (Invokable<?, ?> factory : getFactoriesToTest()) { try { testEqualsUsing(factory);
/** * Tests null checks against the instance methods of the return values, if any. * * <p>Test fails if default value cannot be determined for a constructor or factory method * parameter, or if the constructor or factory method throws exception. * * @return this tester */ public FactoryMethodReturnValueTester testNulls() throws Exception { for (Invokable<?, ?> factory : getFactoriesToTest()) { Object instance = instantiate(factory); if (instance != null && packagesToTest.contains(Reflection.getPackageName(instance.getClass()))) { try { nullPointerTester.testAllPublicInstanceMethods(instance); } catch (AssertionError e) { AssertionError error = new AssertionFailedError("Null check failed on return value of " + factory); error.initCause(e); throw error; } } } return this; }
/** * Runs serialization test on the return values of the static methods. * * <p>Test fails if default value cannot be determined for a constructor or factory method * parameter, or if the constructor or factory method throws exception. * * @return this tester */ public FactoryMethodReturnValueTester testSerializable() throws Exception { for (Invokable<?, ?> factory : getFactoriesToTest()) { Object instance = instantiate(factory); if (instance != null) { try { SerializableTester.reserialize(instance); } catch (RuntimeException e) { AssertionError error = new AssertionFailedError("Serialization failed on return value of " + factory); error.initCause(e.getCause()); throw error; } } } return this; }
/** * Tests {@link Object#equals} and {@link Object#hashCode} against the return values of the * static methods, by asserting that when equal parameters are passed to the same static method, * the return value should also be equal; and vice versa. * * <p>Test fails if default value cannot be determined for a constructor or factory method * parameter, or if the constructor or factory method throws exception. * * @return this tester */ public FactoryMethodReturnValueTester testEquals() throws Exception { for (Invokable<?, ?> factory : getFactoriesToTest()) { try { testEqualsUsing(factory); } catch (FactoryMethodReturnsNullException e) { // If the factory returns null, we just skip it. } } return this; }
/** * Runs serialization test on the return values of the static methods. * * <p>Test fails if default value cannot be determined for a constructor or factory method * parameter, or if the constructor or factory method throws exception. * * @return this tester */ public FactoryMethodReturnValueTester testSerializable() throws Exception { for (Invokable<?, ?> factory : getFactoriesToTest()) { Object instance = instantiate(factory); if (instance != null) { try { SerializableTester.reserialize(instance); } catch (RuntimeException e) { AssertionError error = new AssertionFailedError( "Serialization failed on return value of " + factory); error.initCause(e.getCause()); throw error; } } } return this; }
/** * Tests {@link Object#equals} and {@link Object#hashCode} against the return values of the * static methods, by asserting that when equal parameters are passed to the same static method, * the return value should also be equal; and vice versa. * * <p>Test fails if default value cannot be determined for a constructor or factory method * parameter, or if the constructor or factory method throws exception. * * @return this tester */ public FactoryMethodReturnValueTester testEquals() throws Exception { for (Invokable<?, ?> factory : getFactoriesToTest()) { try { testEqualsUsing(factory); } catch (FactoryMethodReturnsNullException e) { // If the factory returns null, we just skip it. } } return this; }
/** * Tests {@link Object#equals} and {@link Object#hashCode} against the return values of the * static methods, by asserting that when equal parameters are passed to the same static method, * the return value should also be equal; and vice versa. * * <p>Test fails if default value cannot be determined for a constructor or factory method * parameter, or if the constructor or factory method throws exception. * * @return this tester */ public FactoryMethodReturnValueTester testEquals() throws Exception { for (Invokable<?, ?> factory : getFactoriesToTest()) { try { testEqualsUsing(factory); } catch (FactoryMethodReturnsNullException e) { // If the factory returns null, we just skip it. } } return this; }