OAuth { public ZonkyApiToken login(final char[] code) { return api.call(a -> a.login(toString(code), "https: } OAuth(final Api<ZonkyOAuthApi> api); ZonkyApiToken login(final char[] code); ZonkyApiToken refresh(final ZonkyApiToken token);  }
@Test void login() { final ZonkyOAuthApi api = mock(ZonkyOAuthApi.class); when(api.login(anyString(), anyString(), anyString())).thenReturn(mock(ZonkyApiTokenImpl.class)); final Api<ZonkyOAuthApi> wrapper = new Api<>(api); final OAuth oauth = new OAuth(wrapper); final ZonkyApiToken token = oauth.login(PASSWORD.toCharArray()); assertThat(token).isNotNull(); verify(api, times(1)) .login(eq(PASSWORD), any(), eq("authorization_code")); }