### Question:
IntermediatePathComposer { public String retrieveIntermediatePath(LaunchDataWrapper launchDataWrapper, ParamsMap paramsMap, String defaultIntermediatePath) { if(paramsMap != null) { String intermediatePath = paramsMap.getString(INTERMEDIATE_PATH_KEY, null); if(StringUtils.isNotBlank(intermediatePath)) { validateIntermediatePath( intermediatePath, launchDataWrapper.getPropertyRetriever().getField(INTERMEDIATE_REQUIRED_PATH_TOKENS_KEY, null), launchDataWrapper); return intermediatePath; } } return defaultIntermediatePath; } IntermediatePathComposer(); IntermediatePathComposer setReferenceTokenReplacer(ReferenceTokenReplacer referenceTokenReplacer); IntermediatePathComposer setTokenStringValidatorFactory(TokenStringValidatorFactory tokenStringValidatorFactory); String retrieveIntermediatePath(LaunchDataWrapper launchDataWrapper, ParamsMap paramsMap, String defaultIntermediatePath); void configureIntermediatePath(ParamsMap paramsMap, String intermediatePath);  }### Answer:
@Test(dataProvider = "getIntermediatePathProvider") public void testGetIntermediatePath(String requiredTokens, String intermediatePath, String defaultIntermediatePath, final String EXPECTED_RESULT) { doReturn(intermediatePath).when(mockReferenceTokenReplacer).replaceReferenceTokens(anyString(), any()); doReturn(requiredTokens).when(mockPropertyRetriever).getField(IntermediatePathComposer.INTERMEDIATE_REQUIRED_PATH_TOKENS_KEY, null); if(StringUtils.isNotBlank(intermediatePath)) paramsMap.put(IntermediatePathComposer.INTERMEDIATE_PATH_KEY, intermediatePath); Assert.assertEquals(composer.retrieveIntermediatePath(mockLaunchDataWrapper, paramsMap, defaultIntermediatePath), EXPECTED_RESULT); }
@Test(expectedExceptions = StringValidationException.class) public void testGetInterMediatePathException() { doReturn(TOKEN_MISSING).when(mockReferenceTokenReplacer).replaceReferenceTokens(anyString(), any()); doReturn(TOKEN_MISSING).when(mockPropertyRetriever).getField(IntermediatePathComposer.INTERMEDIATE_REQUIRED_PATH_TOKENS_KEY, null); paramsMap.put(IntermediatePathComposer.INTERMEDIATE_PATH_KEY, INTERMEDIATE_PATH); composer.retrieveIntermediatePath(mockLaunchDataWrapper, paramsMap, DEFAULT_INTERMEDIATE_PATH); }