CRest { public static CRestBuilder basicAuth(String username, String password){ return new CRestBuilder().basicAuth(username, password); }  abstract T build(Class<T> interfaze); static CRest getInstance(); static CRest getInstance(String endpoint); static CRest getInstance(Map<String,String> placeholders); static CRest getOAuthInstance(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret); static CRest getOAuthInstance(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret, String sessionHandle, String accessTokenRefreshUrl); static CRest getBasicAuthInstance(String username, String password); static CRestBuilder endpoint(String endpoint); static CRestBuilder property(String name, Object value); static CRestBuilder placeholder(String placeholder, String value); static CRestBuilder placeholders(Map<String,String> placeholders); static CRestBuilder oauth(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret); static CRestBuilder oauth(String consumerKey, String consumerSecret, String accessToken, String accessTokenSecret, String sessionHandle, String accessTokenRefreshUrl); static CRestBuilder basicAuth(String username, String password);  }
@Test public void basicAuthShouldReturnABasicAuthReadyCRestBuilder(){ CRestBuilder expected = mock(CRestBuilder.class); when(builder.basicAuth("a","b")).thenReturn(expected); assertSame(expected, CRest.basicAuth("a","b")); verify(builder).basicAuth("a","b"); verifyNoMoreInteractions(builder); }