@SuppressWarnings("serial")
@Test
public void generateCompleteURI_successfulURIGeneration_optionalParams() {

	String uriSignature = "http://dr-site.esrin.esa.int/{catalogue}/genesi/ASA_IMS_1P/rdf/?count={count?}&startPage={startPage?}&startIndex={startIndex?}&q={searchTerms?}";
	Map<String, String> allParameters = new HashMap<String, String>() {
		{
			put("catalogue", "catalogue");
			put("count?", "10");
			put("startPage?", "1");
			put("startIndex?", "1");
			put("searchTerms?", "term1");
		}
	};
	Map<String, String> parametersMissingOptional = new HashMap<String, String>() {
		{
			put("catalogue", "catalogue");
			put("count?", "10");
			put("searchTerms?", "term1");
		}
	};
	Map<String, String> parametersMissingFirstOptional = new HashMap<String, String>() {
		{
			put("catalogue", "catalogue");
			put("startPage?", "1");
			put("startIndex?", "1");
			put("searchTerms?", "term1");
		}
	};
	String completeURI1 = URISignatureHandler.generateCompleteURI(
			uriSignature, allParameters, false);
	assertEquals(
		"http://dr-site.esrin.esa.int/catalogue/genesi/ASA_IMS_1P/rdf/?count=10&startPage=1&startIndex=1&q=term1",
			completeURI1);
	String completeURI2 = URISignatureHandler.generateCompleteURI(
			uriSignature, parametersMissingOptional, false);
	assertEquals(
			"http://dr-site.esrin.esa.int/catalogue/genesi/ASA_IMS_1P/rdf/?count=10&q=term1",
			completeURI2);
	String completeURI3 = URISignatureHandler.generateCompleteURI(
			uriSignature, parametersMissingFirstOptional, false);
	assertEquals(
			"http://dr-site.esrin.esa.int/catalogue/genesi/ASA_IMS_1P/rdf/?startPage=1&startIndex=1&q=term1",
			completeURI3);
}