forked from btraceio/btrace
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArgsMapTest.java
More file actions
55 lines (46 loc) · 1.37 KB
/
ArgsMapTest.java
File metadata and controls
55 lines (46 loc) · 1.37 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
package com.sun.btrace;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;
public class ArgsMapTest {
private static final String KEY1 = "key1";
private static final String KEY2 = "key2";
private static final String VALUE1 = "value1";
private static final String VALUE2 = "value2";
private ArgsMap instance;
@Before
public void setUp() {
instance = new ArgsMap();
instance.put(KEY1, VALUE1);
instance.put(KEY2, VALUE2);
}
@Test
public void templateExisting() {
String value = instance.template(KEY1 + "=${" + KEY1 + "}");
assertEquals(KEY1 + "=" + VALUE1, value);
}
@Test
public void templateNonExisting() {
String orig = KEY1 + "=${key3}";
String value = instance.template(orig);
assertEquals(orig, value);
}
@Test
public void templateTrailing$() {
String orig = KEY1 + "$";
String value = instance.template(orig);
assertEquals(orig, value);
}
@Test
public void templateUnclosedPlaceholder() {
String orig = KEY1 + "${";
String value = instance.template(orig);
assertEquals(orig, value);
}
@Test
public void templateSingle$() {
String orig = KEY1 + "$" + KEY2;
String value = instance.template(orig);
assertEquals(orig, value);
}
}