@Test public void shouldUseDefaults() throws Exception { FormOAuthInterface expectedOAuthInterface = mock(FormOAuthInterface.class); when(crest.build(FormOAuthInterface.class)).thenReturn(expectedOAuthInterface); OAuthApiV1 mockBuilderResult = mock(OAuthApiV1.class); whenNew(OAuthApiV1.class) .withArguments(MethodType.POST, ENDPOINT, "", "", "", expectedOAuthInterface, token, DefaultVariantProvider.INSTANCE) .thenReturn(mockBuilderResult); OAuthApiV1 actual = toTest.build(); assertEquals(mockBuilderResult, actual); verify(mockCRestBuilder).placeholder("oauth.end-point", ENDPOINT); verify(mockCRestBuilder).placeholder("oauth.access-token.path", ""); verify(mockCRestBuilder).placeholder("oauth.request-token.path", ""); verify(mockCRestBuilder).placeholder("oauth.refresh-access-token.path", ""); verify(mockCRestBuilder).setHttpChannelFactory(any(HttpURLConnectionHttpChannelFactory.class)); }
public OAuthApiV1 build(){ OAuthInterface oauthInterface = crestBuilder.placeholder("oauth.end-point", oauthEndPoint) .placeholder("oauth.access-token.path", accessTokenPath) .placeholder("oauth.request-token.path", requestTokenPath) .placeholder("oauth.refresh-access-token.path", refreshAccessTokenPath) .setHttpChannelFactory(channelFactory) .build() .build(oauthInterfaceCls); return new OAuthApiV1( methodType, oauthEndPoint, requestTokenPath, accessTokenPath, refreshAccessTokenPath, oauthInterface, consumerToken, variantProvider); }
OAuthApiV1Builder { public OAuthApiV1 build(){ OAuthInterface oauthInterface = crestBuilder.placeholder("oauth.end-point", oauthEndPoint) .placeholder("oauth.access-token.path", accessTokenPath) .placeholder("oauth.request-token.path", requestTokenPath) .placeholder("oauth.refresh-access-token.path", refreshAccessTokenPath) .setHttpChannelFactory(channelFactory) .build() .build(oauthInterfaceCls); return new OAuthApiV1( methodType, oauthEndPoint, requestTokenPath, accessTokenPath, refreshAccessTokenPath, oauthInterface, consumerToken, variantProvider); } }
OAuthApiV1Builder { public OAuthApiV1 build(){ OAuthInterface oauthInterface = crestBuilder.placeholder("oauth.end-point", oauthEndPoint) .placeholder("oauth.access-token.path", accessTokenPath) .placeholder("oauth.request-token.path", requestTokenPath) .placeholder("oauth.refresh-access-token.path", refreshAccessTokenPath) .setHttpChannelFactory(channelFactory) .build() .build(oauthInterfaceCls); return new OAuthApiV1( methodType, oauthEndPoint, requestTokenPath, accessTokenPath, refreshAccessTokenPath, oauthInterface, consumerToken, variantProvider); } OAuthApiV1Builder(OAuthToken consumerToken, String oauthEndPoint);   OAuthApiV1Builder(OAuthToken consumerToken, String oauthEndPoint, CRestBuilder crestBuilder); }
OAuthApiV1Builder { public OAuthApiV1 build(){ OAuthInterface oauthInterface = crestBuilder.placeholder("oauth.end-point", oauthEndPoint) .placeholder("oauth.access-token.path", accessTokenPath) .placeholder("oauth.request-token.path", requestTokenPath) .placeholder("oauth.refresh-access-token.path", refreshAccessTokenPath) .setHttpChannelFactory(channelFactory) .build() .build(oauthInterfaceCls); return new OAuthApiV1( methodType, oauthEndPoint, requestTokenPath, accessTokenPath, refreshAccessTokenPath, oauthInterface, consumerToken, variantProvider); } OAuthApiV1Builder(OAuthToken consumerToken, String oauthEndPoint);   OAuthApiV1Builder(OAuthToken consumerToken, String oauthEndPoint, CRestBuilder crestBuilder); OAuthApiV1 build(); OAuthApiV1Builder getRequestTokenFrom(String path); OAuthApiV1Builder getAccessTokenFrom(String path); OAuthApiV1Builder refreshAccessTokenFrom(String path); OAuthApiV1Builder useGet(); OAuthApiV1Builder using(HttpChannelFactory channelFactory); OAuthApiV1Builder using(VariantProvider variantProvider); }
OAuthApiV1Builder { public OAuthApiV1 build(){ OAuthInterface oauthInterface = crestBuilder.placeholder("oauth.end-point", oauthEndPoint) .placeholder("oauth.access-token.path", accessTokenPath) .placeholder("oauth.request-token.path", requestTokenPath) .placeholder("oauth.refresh-access-token.path", refreshAccessTokenPath) .setHttpChannelFactory(channelFactory) .build() .build(oauthInterfaceCls); return new OAuthApiV1( methodType, oauthEndPoint, requestTokenPath, accessTokenPath, refreshAccessTokenPath, oauthInterface, consumerToken, variantProvider); } OAuthApiV1Builder(OAuthToken consumerToken, String oauthEndPoint);   OAuthApiV1Builder(OAuthToken consumerToken, String oauthEndPoint, CRestBuilder crestBuilder); OAuthApiV1 build(); OAuthApiV1Builder getRequestTokenFrom(String path); OAuthApiV1Builder getAccessTokenFrom(String path); OAuthApiV1Builder refreshAccessTokenFrom(String path); OAuthApiV1Builder useGet(); OAuthApiV1Builder using(HttpChannelFactory channelFactory); OAuthApiV1Builder using(VariantProvider variantProvider);  }