diff options
author | Erlend <erlendniko@hotmail.com> | 2022-07-29 14:26:26 +0200 |
---|---|---|
committer | Erlend <erlendniko@hotmail.com> | 2022-07-29 14:26:26 +0200 |
commit | 79336a368800c0e2b691b34cbeccd9f93be5db90 (patch) | |
tree | 5336ad08fc202c93b680eb3b9b4a4cd1133376f4 /config-model/src/test/java/com/yahoo/schema/processing/FastAccessValidatorTest.java | |
parent | 362438cc3eb855854aa6110cf01667f80dd10ba0 (diff) | |
parent | 3afb44d4e4328b2732f65b4a436baa2ce2c850b0 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'config-model/src/test/java/com/yahoo/schema/processing/FastAccessValidatorTest.java')
-rw-r--r-- | config-model/src/test/java/com/yahoo/schema/processing/FastAccessValidatorTest.java | 85 |
1 files changed, 41 insertions, 44 deletions
diff --git a/config-model/src/test/java/com/yahoo/schema/processing/FastAccessValidatorTest.java b/config-model/src/test/java/com/yahoo/schema/processing/FastAccessValidatorTest.java index b249b407c7b..ebf79a4a7d5 100644 --- a/config-model/src/test/java/com/yahoo/schema/processing/FastAccessValidatorTest.java +++ b/config-model/src/test/java/com/yahoo/schema/processing/FastAccessValidatorTest.java @@ -5,57 +5,54 @@ import com.yahoo.config.model.test.TestUtil; import com.yahoo.schema.RankProfileRegistry; import com.yahoo.schema.ApplicationBuilder; import com.yahoo.schema.parser.ParseException; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author bjorncs */ public class FastAccessValidatorTest { - @SuppressWarnings("deprecation") - @Rule - public final ExpectedException exceptionRule = ExpectedException.none(); - @Test - public void throws_exception_on_incompatible_use_of_fastaccess() throws ParseException { - ApplicationBuilder builder = new ApplicationBuilder(new RankProfileRegistry()); - builder.addSchema( - TestUtil.joinLines( - "schema parent {", - " document parent {", - " field int_field type int { indexing: attribute }", - " }", - "}")); - builder.addSchema( - TestUtil.joinLines( - "schema test {", - " document test { ", - " field int_attribute type int { ", - " indexing: attribute ", - " attribute: fast-access", - " }", - " field predicate_attribute type predicate {", - " indexing: attribute ", - " attribute: fast-access", - " }", - " field tensor_attribute type tensor(x[5]) {", - " indexing: attribute ", - " attribute: fast-access", - " }", - " field reference_attribute type reference<parent> {", - " indexing: attribute ", - " attribute: fast-access", - " }", - " }", - "}")); - exceptionRule.expect(IllegalArgumentException.class); - exceptionRule.expectMessage( - "For schema 'test': The following attributes have a type that is incompatible " + - "with fast-access: predicate_attribute, tensor_attribute, reference_attribute. " + - "Predicate, tensor and reference attributes are incompatible with fast-access."); - builder.build(true); + void throws_exception_on_incompatible_use_of_fastaccess() throws ParseException { + Throwable exception = assertThrows(IllegalArgumentException.class, () -> { + ApplicationBuilder builder = new ApplicationBuilder(new RankProfileRegistry()); + builder.addSchema( + TestUtil.joinLines( + "schema parent {", + " document parent {", + " field int_field type int { indexing: attribute }", + " }", + "}")); + builder.addSchema( + TestUtil.joinLines( + "schema test {", + " document test { ", + " field int_attribute type int { ", + " indexing: attribute ", + " attribute: fast-access", + " }", + " field predicate_attribute type predicate {", + " indexing: attribute ", + " attribute: fast-access", + " }", + " field tensor_attribute type tensor(x[5]) {", + " indexing: attribute ", + " attribute: fast-access", + " }", + " field reference_attribute type reference<parent> {", + " indexing: attribute ", + " attribute: fast-access", + " }", + " }", + "}")); + builder.build(true); + }); + assertTrue(exception.getMessage().contains("For schema 'test': The following attributes have a type that is incompatible " + + "with fast-access: predicate_attribute, tensor_attribute, reference_attribute. " + + "Predicate, tensor and reference attributes are incompatible with fast-access.")); } } |