Package com.github.tadukoo.junit
Class PojoTest
java.lang.Object
com.github.tadukoo.junit.PojoTest
- All Implemented Interfaces:
DefaultTestValues
Pojo Test is used to test regular POJOs.
- Version:
- Alpha v.0.1
- Author:
- Logan Ferree (Tadukoo)
-
Field Summary
Fields inherited from interface com.github.tadukoo.junit.constant.DefaultTestValues
DEFAULT_TEST_DOUBLE, DEFAULT_TEST_DOUBLE_2, DEFAULT_TEST_KEY, DEFAULT_TEST_KEY_2, DEFAULT_TEST_STRING, DEFAULT_TEST_STRING_2, DEFAULT_WRONG_DOUBLE, DEFAULT_WRONG_KEY, DEFAULT_WRONG_STRING
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionassertDoubleGetSet
(com.github.tadukoo.util.functional.supplier.ThrowingSupplier<Double, T> getter, com.github.tadukoo.util.functional.consumer.ThrowingConsumer<Double, T2> setter) Method to test a double getter and setter for a Pojo, that a value can be set and retrieved.assertStringGetSet
(com.github.tadukoo.util.functional.supplier.ThrowingSupplier<String, T> getter, com.github.tadukoo.util.functional.consumer.ThrowingConsumer<String, T2> setter) Method to test a String getter and setter for a Pojo, that a value can be set and retrieved.assertValueGetSet
(com.github.tadukoo.util.functional.supplier.ThrowingSupplier<V, T> getter, com.github.tadukoo.util.functional.consumer.ThrowingConsumer<V, T2> setter, V value, V value2) Method to test a getter and setter for a Pojo, that a value can be set and retrieved.
-
Constructor Details
-
PojoTest
private PojoTest()Not allowed to create a PojoTest instance
-
-
Method Details
-
assertValueGetSet
public static <V,T extends Throwable, void assertValueGetSetT2 extends Throwable> (com.github.tadukoo.util.functional.supplier.ThrowingSupplier<V, T> getter, com.github.tadukoo.util.functional.consumer.ThrowingConsumer<V, throws T, T2T2> setter, V value, V value2) Method to test a getter and setter for a Pojo, that a value can be set and retrieved. It is set and retrieved twice in a row to check for adding/appending or just always returning the expected value.- Type Parameters:
V
- The value type being set and retrievedT
- AThrowable
that the getter can throwT2
- AThrowable
that the setter can throw- Parameters:
getter
- The getter to be testedsetter
- The setter to be testedvalue
- The first value to be used for testingvalue2
- The second value to be used for testing- Throws:
T
- If the getter throws itT2
- If the setter throws itorg.opentest4j.AssertionFailedError
- If an assertion fails
-
assertStringGetSet
public static <T extends Throwable,T2 extends Throwable> void assertStringGetSet(com.github.tadukoo.util.functional.supplier.ThrowingSupplier<String, T> getter, com.github.tadukoo.util.functional.consumer.ThrowingConsumer<String, throws T, T2T2> setter) Method to test a String getter and setter for a Pojo, that a value can be set and retrieved. It is set and retrieved twice in a row to check for adding/appending or just always returning the expected value.- Type Parameters:
T
- AThrowable
that the getter can throwT2
- AThrowable
that the setter can throw- Parameters:
getter
- The String getter to be testedsetter
- The String setter to be tested- Throws:
T
- If the getter throws itT2
- If the setter throws itorg.opentest4j.AssertionFailedError
- If an assertion fails
-
assertDoubleGetSet
public static <T extends Throwable,T2 extends Throwable> void assertDoubleGetSet(com.github.tadukoo.util.functional.supplier.ThrowingSupplier<Double, T> getter, com.github.tadukoo.util.functional.consumer.ThrowingConsumer<Double, throws T, T2T2> setter) Method to test a double getter and setter for a Pojo, that a value can be set and retrieved. It is set and retrieved twice in a row to check for adding/appending or just always returning the expected value.- Type Parameters:
T
- AThrowable
that the getter can throwT2
- AThrowable
that the setter can throw- Parameters:
getter
- The double getter to be testedsetter
- The double setter to be tested- Throws:
T
- If the getter throws itT2
- If the setter throws itorg.opentest4j.AssertionFailedError
- If an assertion fails
-