ProjectSomeFieldsPredicate implements ProjectPredicate { public PredicateBase generateOperatorBean(String projectOperatorId) { ProjectionPredicate projectionPredicate = new ProjectionPredicate(this.getProjectedFields()); projectionPredicate.setID(projectOperatorId); return projectionPredicate; } ProjectSomeFieldsPredicate(List<String> projectedFields); List<String> getProjectedFields(); void setProjectedFields(List<String> projectedFields); PredicateBase generateOperatorBean(String projectOperatorId); @Override boolean equals(Object other);  }
@Test public void testGenerateOperatorBean00() { String operatorId = "xxx"; List<String> projectedFields = Collections.emptyList(); ProjectSomeFieldsPredicate projectSomeFieldsPredicate = new ProjectSomeFieldsPredicate(projectedFields); PredicateBase computedProjectionBean = projectSomeFieldsPredicate.generateOperatorBean(operatorId); PredicateBase expectedProjectionBean = new ProjectionPredicate(Arrays.asList()); expectedProjectionBean.setID(operatorId); Assert.assertEquals(expectedProjectionBean, computedProjectionBean); }
@Test public void testGenerateOperatorBean01() { String operatorId = "zwx"; List<String> projectedFields = Arrays.asList("field0", "field1"); ProjectSomeFieldsPredicate projectSomeFieldsPredicate = new ProjectSomeFieldsPredicate(projectedFields); PredicateBase computedProjectionBean = projectSomeFieldsPredicate.generateOperatorBean(operatorId); PredicateBase expectedProjectionBean = new ProjectionPredicate(Arrays.asList("field0", "field1")); expectedProjectionBean.setID(operatorId); Assert.assertEquals(expectedProjectionBean, computedProjectionBean); }
@Test public void testGenerateOperatorBean02() { String operatorId = "op00"; List<String> projectedFields = Arrays.asList("c", "a", "b"); ProjectSomeFieldsPredicate projectSomeFieldsPredicate = new ProjectSomeFieldsPredicate(projectedFields); PredicateBase computedProjectionBean = projectSomeFieldsPredicate.generateOperatorBean(operatorId); PredicateBase expectedProjectionBean = new ProjectionPredicate(Arrays.asList("c", "a", "b")); expectedProjectionBean.setID(operatorId); Assert.assertEquals(expectedProjectionBean, computedProjectionBean); }