KeywordExtractPredicate implements ExtractPredicate { @Override public KeywordPredicate generateOperatorBean(String extractionOperatorId) { KeywordPredicate keywordPredicate = new KeywordPredicate( this.keywords, this.matchingFields, null, KeywordMatchingType.fromName(this.matchingType), extractionOperatorId); keywordPredicate.setID(extractionOperatorId); return keywordPredicate; } KeywordExtractPredicate();  KeywordExtractPredicate(List<String> matchingFields, String keywords, String matchingType); List<String> getMatchingFields(); void setMatchingFields(List<String> matchingFields); String getKeywords(); void setKeywords(String keywords); String getMatchingType(); void setMatchingType(String matchingType); @Override KeywordPredicate generateOperatorBean(String extractionOperatorId); @Override boolean equals(Object other);  }
@Test public void testGeneratePredicateBase01() { String operatorId = "operator"; List<String> matchingFields = Arrays.asList("fieldOne"); String keywords = "keyword(s)"; String matchingType = KeywordMatchingType.PHRASE_INDEXBASED.toString(); KeywordExtractPredicate keywordExtractPredicate = new KeywordExtractPredicate(matchingFields, keywords, matchingType); PredicateBase computedProjectionBean = keywordExtractPredicate.generateOperatorBean(operatorId); PredicateBase expectedProjectionBean = new KeywordPredicate(keywords, matchingFields, null, KeywordMatchingType.fromName(matchingType), operatorId); expectedProjectionBean.setID(operatorId); Assert.assertEquals(expectedProjectionBean, computedProjectionBean); }
@Test public void testGeneratePredicateBase02() { String operatorId = "keywordExtract00"; List<String> matchingFields = Arrays.asList("field0", "field1"); String keywords = "xxx"; String matchingType = KeywordMatchingType.SUBSTRING_SCANBASED.toString(); KeywordExtractPredicate keywordExtractPredicate = new KeywordExtractPredicate(matchingFields, keywords, matchingType); PredicateBase computedProjectionBean = keywordExtractPredicate.generateOperatorBean(operatorId); PredicateBase expectedProjectionBean = new KeywordPredicate(keywords, matchingFields, null, KeywordMatchingType.fromName(matchingType), operatorId); expectedProjectionBean.setID(operatorId); Assert.assertEquals(expectedProjectionBean, computedProjectionBean); }
@Test public void testGeneratePredicateBase00() { String operatorId = "xxx"; List<String> matchingFields = Collections.emptyList(); String keywords = "keyword"; String matchingType = KeywordMatchingType.CONJUNCTION_INDEXBASED.toString(); KeywordExtractPredicate keywordExtractPredicate = new KeywordExtractPredicate(matchingFields, keywords, matchingType); PredicateBase computedProjectionBean = keywordExtractPredicate.generateOperatorBean(operatorId); PredicateBase expectedProjectionBean = new KeywordPredicate(keywords, matchingFields, null, KeywordMatchingType.fromName(matchingType), operatorId); expectedProjectionBean.setID(operatorId); Assert.assertEquals(expectedProjectionBean, computedProjectionBean); }