blob: 287cc6559d12c3e04baeb881c5b740823909c427 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.schema.processing;
import com.yahoo.schema.parser.ParseException;
import org.junit.Test;
import static com.yahoo.schema.ApplicationBuilder.createFromString;
import static com.yahoo.config.model.test.TestUtil.joinLines;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
/**
* @author geirst
*/
public class BoolAttributeValidatorTestCase {
@Test
public void array_of_bool_attribute_is_not_supported() throws ParseException {
try {
createFromString(getSd("field b type array<bool> { indexing: attribute }"));
fail("Expected exception");
}
catch (IllegalArgumentException e) {
assertEquals("For schema 'test', field 'b': Only single value bool attribute fields are supported",
e.getMessage());
}
}
@Test
public void weigtedset_of_bool_attribute_is_not_supported() throws ParseException {
try {
createFromString(getSd("field b type weightedset<bool> { indexing: attribute }"));
fail("Expected exception");
}
catch (IllegalArgumentException e) {
assertEquals("For schema 'test', field 'b': Only single value bool attribute fields are supported",
e.getMessage());
}
}
private String getSd(String field) {
return joinLines(
"schema test {",
" document test {",
" " + field,
" }",
"}");
}
}
|