diff --git a/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/AbstractFluentListConditions.java b/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/AbstractFluentListConditions.java index 0d7c4828f2..3bb19c3660 100644 --- a/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/AbstractFluentListConditions.java +++ b/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/AbstractFluentListConditions.java @@ -3,7 +3,6 @@ import java.util.List; import java.util.function.Predicate; -import org.fluentlenium.core.domain.FluentList; import org.fluentlenium.core.domain.FluentWebElement; /** @@ -64,7 +63,7 @@ public List getActualElements() { } @Override - public DynamicIntegerConditions size() { + public AbstractIntegerConditions size() { return new DynamicIntegerConditionsImpl(() -> elements, negation); } diff --git a/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/DynamicIntegerConditions.java b/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/AbstractIntegerConditions.java similarity index 87% rename from fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/DynamicIntegerConditions.java rename to fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/AbstractIntegerConditions.java index e78c00e764..099cdefd40 100644 --- a/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/DynamicIntegerConditions.java +++ b/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/AbstractIntegerConditions.java @@ -1,18 +1,12 @@ package org.fluentlenium.core.conditions; -import java.util.List; - import org.fluentlenium.core.conditions.message.Message; import org.fluentlenium.core.conditions.message.NotMessage; -import org.fluentlenium.core.domain.FluentWebElement; -/** - * Conditions API for Integer. - */ -public interface DynamicIntegerConditions extends Conditions> { +public interface AbstractIntegerConditions extends Conditions { @Override @Negation - DynamicIntegerConditions not(); + C not(); /** * Check that this is equal to given value @@ -63,5 +57,4 @@ public interface DynamicIntegerConditions extends Conditions> - implements DynamicIntegerConditions { - /** - * Creates a new conditions object on integer. - * - * @param supplier underlying integer - */ - public DynamicIntegerConditionsImpl(Supplier> supplier) { - super(supplier.get()); - } - + implements ListIntegerConditions { /** * Creates a new conditions object on integer. * * @param supplier underlying list * @param negation negation value */ - public DynamicIntegerConditionsImpl(Supplier> supplier, boolean - negation) { + public DynamicIntegerConditionsImpl(Supplier> supplier, boolean negation) { super(supplier.get(), negation); } diff --git a/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/FluentListConditions.java b/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/FluentListConditions.java index 2bc5b7f8df..d5d3934bd2 100644 --- a/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/FluentListConditions.java +++ b/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/FluentListConditions.java @@ -55,5 +55,5 @@ public interface FluentListConditions extends FluentConditions { * @return an object to configure advanced conditions on size */ @MessageContext("size") - DynamicIntegerConditions size(); + AbstractIntegerConditions size(); } diff --git a/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/IntegerConditions.java b/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/IntegerConditions.java index 8bbe2bdaae..200febccdd 100644 --- a/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/IntegerConditions.java +++ b/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/IntegerConditions.java @@ -1,67 +1,8 @@ package org.fluentlenium.core.conditions; -import org.fluentlenium.core.conditions.message.Message; -import org.fluentlenium.core.conditions.message.NotMessage; - /** * Conditions API for Integer. */ - - -//todo consider removal of this class and replacing by DynamicIntegerConditions -public interface IntegerConditions extends Conditions { - @Override - @Negation - IntegerConditions not(); - - /** - * Check that this is equal to given value - * - * @param value the value to compare with - * @return true if is equals, false otherwise - */ - @Message("is equal to {0}") - @NotMessage("is not equal to {0}") - boolean equalTo(int value); - - /** - * Check that this is less than given value - * - * @param value the value to compare with - * @return true if less than, false otherwise - */ - @Message("is less than {0}") - @NotMessage("is not less than {0}") - boolean lessThan(int value); - - /** - * Check that this is less than or equal given value - * - * @param value the value to compare with - * @return true if less than or equal, false otherwise - */ - @Message("is less than or equal to {0}") - @NotMessage("is not less than or equal to {0}") - boolean lessThanOrEqualTo(int value); - - /** - * Check that this is greater than given value - * - * @param value the value to compare with - * @return true if greater than, false otherwise - */ - @Message("is greater than {0}") - @NotMessage("is not greater than {0}") - boolean greaterThan(int value); - - /** - * Check that this is greater than or equal given value - * - * @param value the value to compare with - * @return true if greater than or equal, false otherwise - */ - @Message("is greater than or equal to {0}") - @NotMessage("is not greater than or equal to {0}") - boolean greaterThanOrEqualTo(int value); +public interface IntegerConditions extends AbstractIntegerConditions { } diff --git a/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/ListIntegerConditions.java b/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/ListIntegerConditions.java new file mode 100644 index 0000000000..80b241016c --- /dev/null +++ b/fluentlenium-core/src/main/java/org/fluentlenium/core/conditions/ListIntegerConditions.java @@ -0,0 +1,13 @@ +package org.fluentlenium.core.conditions; + +import java.util.List; + +import org.fluentlenium.core.domain.FluentWebElement; + +/** + * Conditions API for FluentLists. + */ +public interface ListIntegerConditions extends AbstractIntegerConditions, + ListIntegerConditions> { + +}