ValidateFieldTypes extends Processor { @Override public void process(boolean validate, boolean documentsOnly) { if (!validate) return; String searchName = search.getName(); Map<String, DataType> seenFields = new HashMap<>(); verifySearchAndDocFields(searchName, seenFields); verifySummaryFields(searchName, seenFields); } ValidateFieldTypes(Search search, DeployLogger deployLogger, RankProfileRegistry rankProfileRegistry, QueryProfiles queryProfiles); @Override void process(boolean validate, boolean documentsOnly);  }
@Test public void throws_exception_if_type_of_document_field_does_not_match_summary_field() { Search search = createSearchWithDocument(DOCUMENT_NAME); search.setImportedFields(createSingleImportedField(IMPORTED_FIELD_NAME, DataType.INT)); search.addSummary(createDocumentSummary(IMPORTED_FIELD_NAME, DataType.STRING)); ValidateFieldTypes validator = new ValidateFieldTypes(search, null, null, null); exceptionRule.expect(IllegalArgumentException.class); exceptionRule.expectMessage( "For search '" + DOCUMENT_NAME + "', field '" + IMPORTED_FIELD_NAME + "': Incompatible types. " + "Expected int for summary field '" + IMPORTED_FIELD_NAME + "', got string."); validator.process(true, false); }