### Question:
OaiPmhRequestFactory { public static void validateParameterNames(String request) throws BadArgumentException, BadVerbException { Map<OaiParameterName, String> parameters = prepareParameters(request, false); validateMandatoryParameters(parameters); validateDateParameters(parameters.get(OaiParameterName.FROM), parameters.get(OaiParameterName.UNTIL)); } private  OaiPmhRequestFactory(); static void validateVerb(String verb); static void validateParameterNames(String request); static OAIRequest createRequest(String baseUrl, String request, boolean ignoreErrors); static ListSetsRequest createListSetsRequest(String baseUrl, String resumptionToken); static ListSetsRequest createListSetsRequest(String baseUrl, String from, String until); static ListIdentifiersRequest createListIdentifiersRequest(String baseUrl, String metadataPrefix, String set, String from, String until); static ListIdentifiersRequest createListIdentifiersRequest(String baseUrl, String resumptionToken); static IdentifyRequest createIdentifyRequest(String baseUrl); static GetRecordRequest createGetRecordRequest(String baseUrl, String metadataPrefix, String identifier); static ListMetadataFormatsRequest createListMetadataFormatsRequest(String baseUrl, String identifier); static ListRecordsRequest createListRecordsRequest(String baseUrl, String metadataPrefix, String set, String from, String until); static ListRecordsRequest createListRecordsRequest(String baseUrl, String resumptionToken);  }### Answer:
@Test public void validateParameterNamesValid() { try { OaiPmhRequestFactory.validateParameterNames(VALID_REQUEST); } catch (BadArgumentException | BadVerbException e) { fail(); } }
@Test(expected = BadArgumentException.class) public void validateMandatoryParametersListIdentifiers() throws BadVerbException, BadArgumentException { OaiPmhRequestFactory.validateParameterNames(LIST_IDENTIFIERS_GENERAL_REQUEST); OaiPmhRequestFactory.validateParameterNames(LIST_IDENTIFIERS_NO_MANDATORY_REQUEST); }
@Test(expected = BadArgumentException.class) public void validateMandatoryParametersGetRecord() throws BadVerbException, BadArgumentException { OaiPmhRequestFactory.validateParameterNames(GET_RECORD_GENERAL_REQUEST); OaiPmhRequestFactory.validateParameterNames(GET_RECORD_NO_MANDATORY_REQUEST); }
@Test public void validateMandatoryParametersIdentify() throws BadVerbException, BadArgumentException { OaiPmhRequestFactory.validateParameterNames(IDENTIFY_REQUEST); }
@Test(expected = BadArgumentException.class) public void validateParameterNamesEmptyOrNull() throws BadArgumentException, BadVerbException { OaiPmhRequestFactory.validateParameterNames(EMPTY_PARAMETER_NAME_REQUEST); }
@Test(expected = BadArgumentException.class) public void validateParameterValueEmptyOrNull() throws BadArgumentException, BadVerbException { OaiPmhRequestFactory.validateParameterNames(EMPTY_PARAMETER_VALUE_REQUEST); }
@Test(expected = BadArgumentException.class) public void validateParameterNamesInvalidName() throws BadArgumentException, BadVerbException { OaiPmhRequestFactory.validateParameterNames(INVALID_PARAMETER_NAME_REQUEST); }
@Test(expected = BadArgumentException.class) public void validateParameterNamesMultiParameter() throws BadArgumentException, BadVerbException { OaiPmhRequestFactory.validateParameterNames(MULTI_PARAMETER_REQUEST_1); OaiPmhRequestFactory.validateParameterNames(MULTI_PARAMETER_REQUEST_2); }
@Test(expected = BadArgumentException.class) public void validateParameterNamesWrongDates() throws BadArgumentException, BadVerbException { OaiPmhRequestFactory.validateParameterNames("verb=ListIdentifiers&from=2000-01-01T00:00:00Z&until=1995-01-01T00:00:00Z"); }