### Question:
FrequentlyRelatedContentRequestParameterValidator implements SearchRequestParameterValidator { @Override public ValidationMessage validateParameters(Map<String, String> requestParameters) { String id = requestParameters.get(idParameter); if(id == null || id.length()==0) return INVALID_ID_MESSAGE; else return VALID_ID_MESSAGE; } FrequentlyRelatedContentRequestParameterValidator(Configuration configuration); @Override ValidationMessage validateParameters(Map<String, String> requestParameters); final ValidationMessage VALID_ID_MESSAGE; final ValidationMessage INVALID_ID_MESSAGE; }### Answer:
@Test public void testMissingIdParameterReturnsInvalidMessage() { ValidationMessage message = validator.validateParameters(new HashMap<String, String>()); assertSame(message,validator.INVALID_ID_MESSAGE); }
@Test public void testIdParameterReturnsValidMessage() { ValidationMessage message = validator.validateParameters(new HashMap<String, String>(){{ put(configuration.getKeyForFrequencyResultId(),"11111");}}); assertSame(message,validator.VALID_ID_MESSAGE); }