-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSimpleIT.java
More file actions
57 lines (45 loc) · 1.51 KB
/
SimpleIT.java
File metadata and controls
57 lines (45 loc) · 1.51 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package com.flowingcode.addons.simpletimer.integration;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.lessThan;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import com.flowingcode.vaadin.testbench.rpc.HasRpcSupport;
import org.junit.Test;
public class SimpleIT extends AbstractViewTest implements HasRpcSupport {
IntegrationCallables $server = createCallableProxy(IntegrationCallables.class);
public SimpleIT() {
super("it");
}
private Double currentTime() {
return $(SimpleTimerElement.class).first().currentTime();
}
@Test
public void countDown() {
assertThat(currentTime(), nullValue());
assertFalse($server.isRunning());
$server.setStartTime(1);
assertThat(currentTime(), equalTo(1.0));
$server.start();
assertTrue($server.isRunning());
double t0 = currentTime();
double t1 = currentTime();
assertThat(t0, lessThan(1.0));
assertThat(t1, lessThan(t0));
}
@Test
public void countUp() {
assertThat(currentTime(), nullValue());
assertFalse($server.isRunning());
$server.setEndTime(1);
assertThat(currentTime(), equalTo(0.0));
$server.start();
assertTrue($server.isRunning());
double t0 = currentTime();
double t1 = currentTime();
assertThat(t0, greaterThan(0.0));
assertThat(t1, greaterThan(t0));
}
}