@Test void reduceToRelatedFieldSpec_whenAllValid_returnCompleteWhiteList() { FieldSpec parameter = FieldSpecFactory.fromType(FieldType.STRING); FieldSpec expected = FieldSpecFactory.fromList(DistributedList.uniform(Arrays.asList(0, 1))).withNotNull(); FieldSpec actual = testInstance.createModifierFromOtherFieldSpec(parameter); assertThat(actual, sameBeanAs(expected)); }
@Override public FieldSpec createModifierFromOtherFieldSpec(FieldSpec otherFieldSpec) { List<Object> whiteList = new ArrayList<>(); for (int i = 0; i < underlyingList.list().size(); i++) { Object testingElement = underlyingList.list().get(i); if (otherFieldSpec.canCombineWithWhitelistValue(testingElement)) { whiteList.add(BigDecimal.valueOf(i)); } } return FieldSpecFactory.fromList(DistributedList.uniform(whiteList)).withNotNull(); }
InMapIndexRelation implements FieldSpecRelation { @Override public FieldSpec createModifierFromOtherFieldSpec(FieldSpec otherFieldSpec) { List<Object> whiteList = new ArrayList<>(); for (int i = 0; i < underlyingList.list().size(); i++) { Object testingElement = underlyingList.list().get(i); if (otherFieldSpec.canCombineWithWhitelistValue(testingElement)) { whiteList.add(BigDecimal.valueOf(i)); } } return FieldSpecFactory.fromList(DistributedList.uniform(whiteList)).withNotNull(); } }
InMapIndexRelation implements FieldSpecRelation { @Override public FieldSpec createModifierFromOtherFieldSpec(FieldSpec otherFieldSpec) { List<Object> whiteList = new ArrayList<>(); for (int i = 0; i < underlyingList.list().size(); i++) { Object testingElement = underlyingList.list().get(i); if (otherFieldSpec.canCombineWithWhitelistValue(testingElement)) { whiteList.add(BigDecimal.valueOf(i)); } } return FieldSpecFactory.fromList(DistributedList.uniform(whiteList)).withNotNull(); } InMapIndexRelation(Field main, Field other, DistributedList<Object> underlyingList); }
InMapIndexRelation implements FieldSpecRelation { @Override public FieldSpec createModifierFromOtherFieldSpec(FieldSpec otherFieldSpec) { List<Object> whiteList = new ArrayList<>(); for (int i = 0; i < underlyingList.list().size(); i++) { Object testingElement = underlyingList.list().get(i); if (otherFieldSpec.canCombineWithWhitelistValue(testingElement)) { whiteList.add(BigDecimal.valueOf(i)); } } return FieldSpecFactory.fromList(DistributedList.uniform(whiteList)).withNotNull(); } InMapIndexRelation(Field main, Field other, DistributedList<Object> underlyingList); @Override FieldSpec createModifierFromOtherFieldSpec(FieldSpec otherFieldSpec); @Override FieldSpec createModifierFromOtherValue(DataBagValue otherFieldGeneratedValue); @Override FieldSpecRelation inverse(); @Override Field main(); @Override Field other(); DistributedList<Object> getUnderlyingList(); @Override Constraint negate(); }
InMapIndexRelation implements FieldSpecRelation { @Override public FieldSpec createModifierFromOtherFieldSpec(FieldSpec otherFieldSpec) { List<Object> whiteList = new ArrayList<>(); for (int i = 0; i < underlyingList.list().size(); i++) { Object testingElement = underlyingList.list().get(i); if (otherFieldSpec.canCombineWithWhitelistValue(testingElement)) { whiteList.add(BigDecimal.valueOf(i)); } } return FieldSpecFactory.fromList(DistributedList.uniform(whiteList)).withNotNull(); } InMapIndexRelation(Field main, Field other, DistributedList<Object> underlyingList); @Override FieldSpec createModifierFromOtherFieldSpec(FieldSpec otherFieldSpec); @Override FieldSpec createModifierFromOtherValue(DataBagValue otherFieldGeneratedValue); @Override FieldSpecRelation inverse(); @Override Field main(); @Override Field other(); DistributedList<Object> getUnderlyingList(); @Override Constraint negate();  }