Skip to content

Commit

Permalink
try to fix tests rev.3
Browse files Browse the repository at this point in the history
  • Loading branch information
MarieTask committed Jan 27, 2024
1 parent b7ab506 commit 7a45767
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/hexlet/code/schemas/BaseSchema.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package hexlet.code.schemas;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.function.Predicate;

Expand All @@ -9,7 +9,7 @@ public abstract class BaseSchema {
private Boolean isRequired = false;

protected BaseSchema() {
this.conditions = new ArrayList<>();
this.conditions = new LinkedList<>();
}

//Indicates if the specified attribute is required
Expand All @@ -20,7 +20,7 @@ protected final void addCondition(Predicate<Object> condition) {
conditions.add(condition);
}
public final boolean isValid(Object obj) {
if (!isRequired) {
if (!isRequired && !conditions.stream().findFirst().isEmpty()) {
return true;
}
return (!conditions.stream().allMatch(condition -> condition.test(obj)));
Expand Down

0 comments on commit 7a45767

Please sign in to comment.