OAuth2Parameters { public List<String> getJavaScripts() { WsdlProject project = profile.getContainer().getProject(); return Lists.transform(profile.getAutomationJavaScripts(), new PropertyExpansionFunction(project)); } OAuth2Parameters(OAuth2Profile profile); void setRefreshTokenInProfile(String refreshToken); void setAccessTokenExpirationTimeInProfile(long expirationTime); void setAccessTokenIssuedTimeInProfile(long issuedTime); void waitingForAuthorization(); void receivedAuthorizationCode(); void retrivalCanceled(); void applyRetrievedAccessToken(String accessToken); OAuth2Profile.OAuth2Flow getOAuth2Flow(); List<String> getJavaScripts(); boolean isAccessTokenRetrivedFromServer();  }
@Test public void performsPropertyExpansionInJavaScripts() throws Exception { final String userNamePropertyName = "OAuth_User"; final String userName = "our.google.user"; WsdlProject project = profile.getContainer().getProject(); project.addProperty(userNamePropertyName).setValue(userName); String javaScriptWithExpansion = "document.getElementById('usr').value='${#Project#" + userNamePropertyName + "}'"; profile.setAutomationJavaScripts(Arrays.asList(javaScriptWithExpansion)); OAuth2Parameters parameters = new OAuth2Parameters(profile); String expectedExpandedJavaScript = "document.getElementById('usr').value='" + userName + "'"; assertThat(parameters.getJavaScripts().get(0), is(expectedExpandedJavaScript)); }