### Question:
UserParamInputParametersProvider extends AbstractInputParametersProvider<Map<String, Object>> { @Override public InputParameter getInputParameter(final Map<String, Object> userParams) { if (userParams != null) { final InputParameter inputParameter = new InputParameter(); final Object additionalParams = userParams.get(ADDITIONAL_PARAMS); if (additionalParams instanceof String) { inputParameter.setAdditionalParams(parseAdditionalParameters(additionalParams.toString())); } final Object extVirtualLinks = userParams.get(EXT_VIRTUAL_LINKS); if (extVirtualLinks instanceof String) { inputParameter.setExtVirtualLinks(parseExternalVirtualLinks(extVirtualLinks.toString())); } LOGGER.info("InputParameter found in userParams : {}", inputParameter); return inputParameter; } LOGGER.warn("No input parameters found ..."); return NullInputParameter.NULL_INSTANCE; }  @Override InputParameter getInputParameter(final Map<String, Object> userParams);  }### Answer:
@Test public void testGetInputParameter_ValidUserParams_NotEmptyInputParameter() throws Exception { final InputParametersProvider<Map<String, Object>> objUnderTest = new UserParamInputParametersProvider(); final InputParameter actual = objUnderTest.getInputParameter(getUserParamsMap(ADDITIONAL_PARAMS_VALUE, EXT_VIRTUAL_LINKS_VALUE)); assertNotNull(actual); final Map<String, String> actualAdditionalParams = actual.getAdditionalParams(); assertEquals(3, actualAdditionalParams.size()); final String actualInstanceType = actualAdditionalParams.get("instance_type"); assertEquals("m1.small", actualInstanceType); final List<ExternalVirtualLink> actualExtVirtualLinks = actual.getExtVirtualLinks(); assertEquals(1, actualExtVirtualLinks.size()); final ExternalVirtualLink actualExternalVirtualLink = actualExtVirtualLinks.get(0); assertEquals("ac1ed33d-8dc1-4800-8ce8-309b99c38eec", actualExternalVirtualLink.getId()); }
@Test public void testGetInputParameter_EmptyOrNullUserParams_EmptyInputParameter() throws Exception { final InputParametersProvider<Map<String, Object>> objUnderTest = new UserParamInputParametersProvider(); InputParameter actual = objUnderTest.getInputParameter(Collections.emptyMap()); assertNotNull(actual); assertTrue(actual.getAdditionalParams().isEmpty()); assertTrue(actual.getExtVirtualLinks().isEmpty()); actual = objUnderTest.getInputParameter(null); assertNotNull(actual); assertTrue(actual instanceof NullInputParameter); assertTrue(actual.getAdditionalParams().isEmpty()); assertTrue(actual.getExtVirtualLinks().isEmpty()); }
@Test public void testGetInputParameter_InValidExtVirtualLinks_NotEmptyInputParameter() throws Exception { final InputParametersProvider<Map<String, Object>> objUnderTest = new UserParamInputParametersProvider(); final InputParameter actual = objUnderTest.getInputParameter(getUserParamsMap(ADDITIONAL_PARAMS_VALUE, EXT_VIRTUAL_LINK_VALUE)); assertNotNull(actual); final Map<String, String> actualAdditionalParams = actual.getAdditionalParams(); assertEquals(3, actualAdditionalParams.size()); final String actualInstanceType = actualAdditionalParams.get("instance_type"); assertEquals("m1.small", actualInstanceType); assertTrue(actual.getExtVirtualLinks().isEmpty()); }