@Test public void testValidateAndReturn_By_Key1() { assertEquals(VALUE1, sut.validateAndReturn(KEY1)); }
@Override public String validateAndReturn(String policyCombiningAlgId) { if (!StringUtils.hasText(policyCombiningAlgId)) { throw new PolicyCombiningAlgIdNotFoundException( "policyCombiningAlgId must have a valid text!"); } if (combiningAlgs.keySet().contains(policyCombiningAlgId)) { policyCombiningAlgId = combiningAlgs.get(policyCombiningAlgId); } else { if (combiningAlgs.entrySet().stream().map(Entry::getValue) .noneMatch(policyCombiningAlgId::equals)) { final StringBuilder errorBuilder = new StringBuilder(); errorBuilder.append("The policyCombiningAlgId: ") .append(policyCombiningAlgId) .append(" is not a valid value!"); throw new InvalidPolicyCombiningAlgIdException( errorBuilder.toString()); } } return policyCombiningAlgId; }
PolicyCombiningAlgIdValidatorImpl implements
		PolicyCombiningAlgIdValidator { @Override public String validateAndReturn(String policyCombiningAlgId) { if (!StringUtils.hasText(policyCombiningAlgId)) { throw new PolicyCombiningAlgIdNotFoundException( "policyCombiningAlgId must have a valid text!"); } if (combiningAlgs.keySet().contains(policyCombiningAlgId)) { policyCombiningAlgId = combiningAlgs.get(policyCombiningAlgId); } else { if (combiningAlgs.entrySet().stream().map(Entry::getValue) .noneMatch(policyCombiningAlgId::equals)) { final StringBuilder errorBuilder = new StringBuilder(); errorBuilder.append("The policyCombiningAlgId: ") .append(policyCombiningAlgId) .append(" is not a valid value!"); throw new InvalidPolicyCombiningAlgIdException( errorBuilder.toString()); } } return policyCombiningAlgId; } }
PolicyCombiningAlgIdValidatorImpl implements
		PolicyCombiningAlgIdValidator { @Override public String validateAndReturn(String policyCombiningAlgId) { if (!StringUtils.hasText(policyCombiningAlgId)) { throw new PolicyCombiningAlgIdNotFoundException( "policyCombiningAlgId must have a valid text!"); } if (combiningAlgs.keySet().contains(policyCombiningAlgId)) { policyCombiningAlgId = combiningAlgs.get(policyCombiningAlgId); } else { if (combiningAlgs.entrySet().stream().map(Entry::getValue) .noneMatch(policyCombiningAlgId::equals)) { final StringBuilder errorBuilder = new StringBuilder(); errorBuilder.append("The policyCombiningAlgId: ") .append(policyCombiningAlgId) .append(" is not a valid value!"); throw new InvalidPolicyCombiningAlgIdException( errorBuilder.toString()); } } return policyCombiningAlgId; }  }
PolicyCombiningAlgIdValidatorImpl implements
		PolicyCombiningAlgIdValidator { @Override public String validateAndReturn(String policyCombiningAlgId) { if (!StringUtils.hasText(policyCombiningAlgId)) { throw new PolicyCombiningAlgIdNotFoundException( "policyCombiningAlgId must have a valid text!"); } if (combiningAlgs.keySet().contains(policyCombiningAlgId)) { policyCombiningAlgId = combiningAlgs.get(policyCombiningAlgId); } else { if (combiningAlgs.entrySet().stream().map(Entry::getValue) .noneMatch(policyCombiningAlgId::equals)) { final StringBuilder errorBuilder = new StringBuilder(); errorBuilder.append("The policyCombiningAlgId: ") .append(policyCombiningAlgId) .append(" is not a valid value!"); throw new InvalidPolicyCombiningAlgIdException( errorBuilder.toString()); } } return policyCombiningAlgId; }  @Override Map<String, String> getCombiningAlgs(); @Override String validateAndReturn(String policyCombiningAlgId); }
PolicyCombiningAlgIdValidatorImpl implements
		PolicyCombiningAlgIdValidator { @Override public String validateAndReturn(String policyCombiningAlgId) { if (!StringUtils.hasText(policyCombiningAlgId)) { throw new PolicyCombiningAlgIdNotFoundException( "policyCombiningAlgId must have a valid text!"); } if (combiningAlgs.keySet().contains(policyCombiningAlgId)) { policyCombiningAlgId = combiningAlgs.get(policyCombiningAlgId); } else { if (combiningAlgs.entrySet().stream().map(Entry::getValue) .noneMatch(policyCombiningAlgId::equals)) { final StringBuilder errorBuilder = new StringBuilder(); errorBuilder.append("The policyCombiningAlgId: ") .append(policyCombiningAlgId) .append(" is not a valid value!"); throw new InvalidPolicyCombiningAlgIdException( errorBuilder.toString()); } } return policyCombiningAlgId; }  @Override Map<String, String> getCombiningAlgs(); @Override String validateAndReturn(String policyCombiningAlgId);  }