use of com.jeanchampemont.wtfdyum.dto.Principal in project WTFDYUM by jchampemont.
the class CronServiceTest method principal.
private Principal principal(final long id) {
when(principalService.getMembers()).thenReturn(new HashSet<>(Arrays.asList(id)));
final Principal principal = new Principal(id, "Principal 1 Token", "Principal 1 Token Secret");
when(principalService.get(id)).thenReturn(principal);
return principal;
}
use of com.jeanchampemont.wtfdyum.dto.Principal in project WTFDYUM by jchampemont.
the class PrincipalServiceTest method getTest.
@Test
public void getTest() {
final Principal u = new Principal(12L, "tokdf", "secrrr");
when(principalRedisTemplate.opsForValue()).thenReturn(valueOperations);
when(valueOperations.get("190")).thenReturn(u);
final Principal principal = sut.get(190L);
assertThat(principal).isNotNull();
assertThat(principal).isEqualTo(u);
}
use of com.jeanchampemont.wtfdyum.dto.Principal in project WTFDYUM by jchampemont.
the class TwitterServiceTest method verifyCredentialsTestFalse.
@Test
public void verifyCredentialsTestFalse() throws TwitterException {
when(twitter.verifyCredentials()).thenThrow(new TwitterException(""));
final boolean result = sut.verifyCredentials(new Principal(12L, "tre", "tr"));
assertThat(result).isFalse();
}
use of com.jeanchampemont.wtfdyum.dto.Principal in project WTFDYUM by jchampemont.
the class TwitterServiceTest method getUsersEmptyTest.
@Test
public void getUsersEmptyTest() throws Exception {
final List<com.jeanchampemont.wtfdyum.dto.User> result = sut.getUsers(new Principal(1L, "", ""), new long[0]);
assertThat(result).isNotNull();
assertThat(result.size()).isEqualTo(0);
}
use of com.jeanchampemont.wtfdyum.dto.Principal in project WTFDYUM by jchampemont.
the class TwitterServiceTest method tweetTest.
@Test
public void tweetTest() throws Exception {
sut.tweet(new Principal(144L, "tok", "toksec"), "my brand new tweet");
verify(twitter, times(1)).updateStatus("my brand new tweet");
}
Aggregations