本文整理了Java中com.github.robozonky.api.remote.entities.ZonkyApiToken.<init>()
方法的一些代码示例,展示了ZonkyApiToken.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZonkyApiToken.<init>()
方法的具体详情如下:
包路径:com.github.robozonky.api.remote.entities.ZonkyApiToken
类名称:ZonkyApiToken
方法名:<init>
暂无
代码示例来源:origin: RoboZonky/robozonky
private static ZonkyApiToken getTokenExpiringIn(final Duration duration) {
return new ZonkyApiToken(UUID.randomUUID().toString(), UUID.randomUUID().toString(),
OffsetDateTime.ofInstant(DateUtil.now().minus(Duration.ofMinutes(5)).plus(duration),
Defaults.ZONE_ID));
}
代码示例来源:origin: RoboZonky/robozonky
@Test
void refresh() {
final String originalTokenId = UUID.randomUUID().toString();
final ZonkyApiToken originToken = new ZonkyApiToken(UUID.randomUUID().toString(), originalTokenId,
OffsetDateTime.now());
final ZonkyApiToken resultToken = mock(ZonkyApiToken.class);
final ZonkyOAuthApi api = mock(ZonkyOAuthApi.class);
when(api.refresh(eq(originalTokenId), anyString(), any())).thenReturn(resultToken);
final Api<ZonkyOAuthApi> wrapper = new Api<>(api);
final OAuth oauth = new OAuth(wrapper);
final ZonkyApiToken returnedToken = oauth.refresh(originToken);
assertThat(returnedToken).isEqualTo(resultToken);
}
}
代码示例来源:origin: RoboZonky/robozonky
@Test
void changes400to401() throws IOException {
final int expectedCode = 400;
final ClientRequestContext ctx = mock(ClientRequestContext.class);
final ClientResponseContext ctx2 = mock(ClientResponseContext.class);
final ZonkyApiToken token = new ZonkyApiToken("", "", 299);
when(ctx2.hasEntity()).thenReturn(true);
when(ctx2.getHeaders()).thenReturn(new MultivaluedMapImpl<>());
when(ctx2.getEntityStream()).thenReturn(c(token));
when(ctx2.getStatusInfo()).thenReturn(Response.Status.fromStatusCode(expectedCode));
when(ctx2.getStatus()).thenReturn(expectedCode);
final RoboZonkyFilter filter = new AuthenticatedFilter(() -> token);
filter.filter(ctx, ctx2);
verify(ctx2, times(1)).setStatus(401);
}
}
代码示例来源:origin: RoboZonky/robozonky
@Test
void fresh() {
final ZonkyApiToken token = new ZonkyApiToken();
assertThat(token.getObtainedOn()).isBeforeOrEqualTo(OffsetDateTime.now());
}
内容来源于网络,如有侵权,请联系作者删除!