Package allurium.interfaces
Interface TextInputAsserts
- All Known Implementing Classes:
AbstractRequiredTextArea
,AbstractRequiredTextField
,TextArea
,TextField
public interface TextInputAsserts
Interface for providing basic assertions on input elements.
This interface is designed to standardize assertions for input elements such as fields and text areas, allowing checks for empty or non-empty states, as well as validating specific values.
Features:
- Asserts that input elements are empty or not empty.
- Validates the current value of input elements.
- Checks whether the input value contains a specific substring.
Purpose:
- Ensures consistency in input validation methods across implementing classes.
- Provides a standardized approach to validate the state of input elements in tests.
Common Implementations:
- Text fields
- Text areas
- Custom input components
Example Usage:
public class TextField implements TextInputAsserts {
// Implementations of assertEmpty(), assertNotEmpty(), etc.
}
// In a test case:
TextField textField = new TextField("input");
textField.assertEmpty();
textField.assertCurrentValue("Expected Value");
-
Method Summary
Modifier and TypeMethodDescriptionvoid
assertCurrentValue
(String value) Asserts that the current value of the input element matches the specified value.void
assertCurrentValueContains
(String value) Asserts that the current value of the input element contains the specified substring.void
Asserts that the input element is empty.void
Asserts that the input element is not empty.
-
Method Details
-
assertEmpty
void assertEmpty()Asserts that the input element is empty.Ensures that the input element's current value is an empty string or has no value. Typically used to verify that a field is cleared or uninitialized.
Example:
TextField textField = new TextField("input"); textField.assertEmpty();
-
assertNotEmpty
void assertNotEmpty()Asserts that the input element is not empty.Ensures that the input element contains some value, typically used to verify that the field is populated during or after user interaction.
Example:
TextField textField = new TextField("input"); textField.assertNotEmpty();
-
assertCurrentValue
Asserts that the current value of the input element matches the specified value.Ensures that the input element's value is exactly equal to the expected value.
Example:
TextField textField = new TextField("input"); textField.assertCurrentValue("Expected Value");
- Parameters:
value
- the expected value to match
-
assertCurrentValueContains
Asserts that the current value of the input element contains the specified substring.Ensures that the input element's value includes the given substring, often used to validate partial matches or expected formats.
Example:
TextField textField = new TextField("input"); textField.assertCurrentValueContains("Expected");
- Parameters:
value
- the substring that the current value should contain
-