forked from snowplow/snowplow-java-tracker
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSubjectTest.java
More file actions
66 lines (53 loc) · 1.85 KB
/
SubjectTest.java
File metadata and controls
66 lines (53 loc) · 1.85 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
58
59
60
61
62
63
64
65
66
package com.snowplowanalytics.snowplow.tracker;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
import static org.junit.Assert.assertEquals;
public class SubjectTest {
@Test
public void testSetUserId() throws Exception {
Subject subject = new Subject();
subject.setUserId("user1");
assertEquals("user1", subject.getSubject().get("uid"));
}
@Test
public void testSetScreenResolution() throws Exception {
Subject subject = new Subject();
subject.setScreenResolution(100, 150);
assertEquals("100x150", subject.getSubject().get("res"));
}
@Test
public void testSetViewPort() throws Exception {
Subject subject = new Subject();
subject.setViewPort(150, 100);
assertEquals("150x100", subject.getSubject().get("vp"));
}
@Test
public void testSetColorDepth() throws Exception {
Subject subject = new Subject();
subject.setColorDepth(10);
assertEquals("10", subject.getSubject().get("cd"));
}
@Test
public void testSetTimezone2() throws Exception {
Subject subject = new Subject();
subject.setTimezone("America/Toronto");
assertEquals("America/Toronto", subject.getSubject().get("tz"));
}
@Test
public void testSetLanguage() throws Exception {
Subject subject = new Subject();
subject.setLanguage("EN");
assertEquals("EN", subject.getSubject().get("lang"));
}
@Test
public void testGetSubject() throws Exception {
Subject subject = new Subject();
Map<String, String> expected = new HashMap<>();
subject.setTimezone("America/Toronto");
subject.setUserId("user1");
expected.put("tz", "America/Toronto");
expected.put("uid", "user1");
assertEquals(expected, subject.getSubject());
}
}