Record Class FPTestClass
java.lang.Object
java.lang.Record
de.oliver.plugintests.FPTestClass
- Record Components:
testClass- the test class to run tests for (must be annotated withFPTest)beforeEach- the method annotated withFPBeforeEachto run before each testafterEach- the method annotated withFPAfterEachto run after each testtestMethods- the list of test methods annotated withFPTest
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theafterEachrecord component.Returns the value of thebeforeEachrecord component.Generates a display name for a given test method, incorporating annotation details if present.final booleanIndicates whether some other object is "equal to" this one.static FPTestClassCreates an instance of FPTestClass by inspecting the provided test class for methods annotated with FPTest, FPBeforeEach, and FPAfterEach annotations.final inthashCode()Returns a hash code value for this object.booleanrunTests(org.bukkit.entity.Player player) Runs the test methods belonging to the test class, performing any necessary setup and teardown operations.Class<?> Returns the value of thetestClassrecord component.Returns the value of thetestMethodsrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
FPTestClass
public FPTestClass(Class<?> testClass, Method beforeEach, Method afterEach, List<Method> testMethods) Creates an instance of aFPTestClassrecord class.- Parameters:
testClass- the value for thetestClassrecord componentbeforeEach- the value for thebeforeEachrecord componentafterEach- the value for theafterEachrecord componenttestMethods- the value for thetestMethodsrecord component
-
-
Method Details
-
fromClass
Creates an instance of FPTestClass by inspecting the provided test class for methods annotated with FPTest, FPBeforeEach, and FPAfterEach annotations. These methods are used to define the setup, teardown, and test methods for the class.- Parameters:
testClass- the class to be inspected for annotated methods- Returns:
- an instance of FPTestClass containing the test class and its annotated methods
-
runTests
public boolean runTests(org.bukkit.entity.Player player) Runs the test methods belonging to the test class, performing any necessary setup and teardown operations.- Parameters:
player- The player context to pass to the test methods.- Returns:
- true if all tests completed successfully, false if any test failed or an unexpected exception occurred.
-
displayName
Generates a display name for a given test method, incorporating annotation details if present.- Parameters:
m- the method for which to generate the display name- Returns:
- a display name that includes the test class and method name, and optionally the value of the FPTest annotation's name attribute if the annotation is present
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
testClass
-
beforeEach
Returns the value of thebeforeEachrecord component.- Returns:
- the value of the
beforeEachrecord component
-
afterEach
-
testMethods
Returns the value of thetestMethodsrecord component.- Returns:
- the value of the
testMethodsrecord component
-