forked from IQSS/dataverse
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(solrteur): add types enum to Field IQSS#7662
Add field types and make them usable as predicates for fields. Add test.
- Loading branch information
1 parent
fea4d1c
commit 03d19e0
Showing
2 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
modules/solr-configset/src/test/java/cli/util/model/FieldTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package cli.util.model; | ||
|
||
import org.junit.jupiter.api.Nested; | ||
import org.junit.jupiter.params.ParameterizedTest; | ||
import org.junit.jupiter.params.provider.NullAndEmptySource; | ||
import org.junit.jupiter.params.provider.ValueSource; | ||
|
||
import java.util.function.Predicate; | ||
import java.util.logging.Logger; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class FieldTest { | ||
|
||
private static final Logger logger = Logger.getLogger(BlockTest.class.getCanonicalName()); | ||
|
||
@Nested | ||
class TypesTest { | ||
Predicate<String> allowedTypes = Field.Types.matchesTypes(); | ||
|
||
@ParameterizedTest | ||
@NullAndEmptySource | ||
@ValueSource(strings = {"foobar", "hello_hello", "NONE", "DATE"}) | ||
void failing(String subject) { | ||
assertFalse(allowedTypes.test(subject)); | ||
} | ||
|
||
@ParameterizedTest | ||
@ValueSource(strings = {"none", "text", "textbox", "date", "email", "int", "float"}) | ||
void succeeding(String subject) { | ||
assertTrue(allowedTypes.test(subject)); | ||
} | ||
} | ||
|
||
} |