blob: 4e1f8f1edd7d7e1f98f074fb84e25edfa0fec5c7 (
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
|
package com.yahoo.searchdefinition.processing;
import com.yahoo.document.DataType;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
/**
* @author geirst
*/
public class ImportedFieldsInSummaryValidatorTestCase {
@Rule
public final ExpectedException exceptionRule = ExpectedException.none();
@Test
public void validator_fails_if_imported_predicate_field_is_used_in_document_summary() {
exceptionRule.expect(IllegalArgumentException.class);
exceptionRule.expectMessage("For search 'child', document summary 'my_summary', " +
"imported summary field 'my_predicate_field': Is of type predicate. Not supported in document summaries");
new SearchModel()
.addImportedField("my_predicate_field", "ref", "predicate_field")
.addSummaryField("my_predicate_field", DataType.PREDICATE)
.resolve();
}
private static class SearchModel extends ImportedFieldsResolverTestCase.SearchModel {
public SearchModel() {
super();
}
public void resolve() {
super.resolve();
new ImportedFieldsInSummayValidator(childSearch, null, null, null).process();
}
}
}
|