forked from scribejava/scribejava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimestampServiceTest.java
More file actions
41 lines (32 loc) · 941 Bytes
/
Copy pathTimestampServiceTest.java
File metadata and controls
41 lines (32 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.github.scribejava.core.services;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
public class TimestampServiceTest {
private TimestampServiceImpl service;
@Before
public void setUp() {
service = new TimestampServiceImpl();
service.setTimer(new TimerStub());
}
@Test
public void shouldReturnTimestampInSeconds() {
final String expected = "1000";
assertEquals(expected, service.getTimestampInSeconds());
}
@Test
public void shouldReturnNonce() {
final String expected = "1042";
assertEquals(expected, service.getNonce());
}
private static class TimerStub extends TimestampServiceImpl.Timer {
@Override
public Long getMilis() {
return 1000000L;
}
@Override
public Integer getRandomInteger() {
return 42;
}
}
}