-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathProblem1Test.java
More file actions
40 lines (29 loc) · 1.18 KB
/
Problem1Test.java
File metadata and controls
40 lines (29 loc) · 1.18 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
package io.zipcoder;
import org.junit.Assert;
import org.junit.Test;
import java.util.HashMap;
import java.util.Map;
public class Problem1Test {
@Test
public void replacementTest(){
Problem1 test = new Problem1();
Map<Character, Character> testMap = new HashMap<Character, Character>();
testMap.put('f','7');
testMap.put('s', '$');
testMap.put('1', '!');
testMap.put('a', '@');
String input = "The Farmer went to the store to get 1 dollar’s worth of fertilizer";
String expected = "The 7@rmer went to the $tore to get ! doll@r’$ worth o7 7ertilizer";
String actual = test.stringReplacer(input);
Assert.assertEquals(expected, actual);
}
@Test
public void replacementRecursionTest(){
Problem1 test = new Problem1();
HashMap<String, String> testMap = new HashMap<String, String>();
String input = "The Farmer went to the store to get 1 dollar’s worth of fertilizer";
String expected = "The 7@rmer went to the $tore to get ! doll@r’$ worth o7 7ertilizer";
String actual = test.stringRecursion(input);
Assert.assertEquals(expected, actual);
}
}