3 import static org.junit.jupiter.api.Assertions.fail;
5 import java.util.Random;
6 import java.util.concurrent.ThreadLocalRandom;
8 import org.apache.logging.log4j.LogManager;
9 import org.apache.logging.log4j.Logger;
10 import org.junit.jupiter.api.BeforeAll;
11 import org.junit.jupiter.api.DisplayName;
12 import org.junit.jupiter.api.Nested;
13 import org.junit.jupiter.api.TestInstance;
14 import org.junit.jupiter.api.TestInstance.Lifecycle;
15 import org.junit.jupiter.api.extension.ExtendWith;
26 @DisplayName(
"Equals Test")
27 @ExtendWith({TimingExtension.class})
30 private static final Logger LOGGER = LogManager.getLogger(
EqualsTest.class);
33 @DisplayName(
"ObservedValue Equals Test")
41 observedValue = createObservedValue(10);
42 }
catch (Exception e) {
43 fail(
"Exception raised when creating the test data.", e);
54 observedValue = createObservedValue(20);
55 }
catch (Exception e) {
56 fail(
"Exception raised when creating the test data.", e);
69 @TestInstance(Lifecycle.PER_CLASS)
70 @DisplayName(
"PersonObject Equals Test")
77 randString =
new RandomString(10, ThreadLocalRandom.current());
85 personObject = createRandomPersonObject();
86 }
catch (Exception e) {
87 fail(
"Exception raised when creating the test data.", e);
98 personObject = createRandomPersonObject();
99 }
catch (Exception e) {
100 fail(
"Exception raised when creating the test data.", e);
108 String randomString = randString.
nextString();
110 Random random = ThreadLocalRandom.current();
111 int randomInt = random.nextInt(200);
113 LOGGER.debug(
"Created PersonObject[name: " + randomString +
", age: " + randomInt +
"]");
Class that wraps a value and gives the utility of registering listeners that will be called after any...
ObservedValue< Integer > createNotEqualValue()
Creates and returns a non equal value to use in the equality tests.
This class defines test of equality that the objects should pass.
PersonObject createRandomPersonObject()
String nextString()
Returns a pseudorandom, uniformly distributed.
PersonObject createNotEqualValue()
Creates and returns a non equal value to use in the equality tests.
PersonObject createValue()
Creates and returns a value used for testing.
The TimingExtension class implements the BeforeTestExecutionCallback and the AfterTestExecutionCallba...
This interface defines tests to verify that the objects implements correctly the.
ObservedValue< Integer > createObservedValue(int value)
A class to generate pseudorandom sequences of strings.
ObservedValue< Integer > createValue()
Creates and returns a value used for testing.