Skip to content

Commit fb47686

Browse files
authored
Converting Atbash tests to AssertJ (exercism#2018)
1 parent 59e9bea commit fb47686

1 file changed

Lines changed: 24 additions & 20 deletions

File tree

‎exercises/practice/atbash-cipher/src/test/java/AtbashTest.java‎

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import org.junit.Ignore;
33
import org.junit.Test;
44

5-
import static org.junit.Assert.assertEquals;
5+
import static org.assertj.core.api.Assertions.assertThat;
66

77
public class AtbashTest {
88

@@ -15,87 +15,91 @@ public void setup() {
1515

1616
@Test
1717
public void testEncodeYes() {
18-
assertEquals("bvh", atbash.encode("yes"));
18+
assertThat(atbash.encode("yes")).isEqualTo("bvh");
1919
}
2020

2121
@Ignore("Remove to run test")
2222
@Test
2323
public void testEncodeNo() {
24-
assertEquals("ml", atbash.encode("no"));
24+
assertThat(atbash.encode("no")).isEqualTo("ml");
2525
}
2626

2727
@Ignore("Remove to run test")
2828
@Test
2929
public void testEncodeOmgInCapital() {
30-
assertEquals("lnt", atbash.encode("OMG"));
30+
assertThat(atbash.encode("OMG")).isEqualTo("lnt");
3131
}
3232

3333
@Ignore("Remove to run test")
3434
@Test
3535
public void testEncodeOmgWithSpaces() {
36-
assertEquals("lnt", atbash.encode("O M G"));
36+
assertThat(atbash.encode("O M G")).isEqualTo("lnt");
3737
}
3838

3939
@Ignore("Remove to run test")
4040
@Test
4141
public void testEncodeMindBlowingly() {
42-
assertEquals("nrmwy oldrm tob", atbash.encode("mindblowingly"));
42+
assertThat(atbash.encode("mindblowingly")).isEqualTo("nrmwy oldrm tob");
4343
}
4444

4545
@Ignore("Remove to run test")
4646
@Test
4747
public void testEncodeNumbers() {
48-
assertEquals("gvhgr mt123 gvhgr mt", atbash.encode("Testing,1 2 3, testing."));
48+
assertThat(atbash.encode("Testing,1 2 3, testing."))
49+
.isEqualTo("gvhgr mt123 gvhgr mt");
4950
}
5051

5152
@Ignore("Remove to run test")
5253
@Test
5354
public void testEncodeDeepThought() {
54-
assertEquals("gifgs rhurx grlm", atbash.encode("Truth is fiction."));
55+
assertThat(atbash.encode("Truth is fiction."))
56+
.isEqualTo("gifgs rhurx grlm");
5557
}
5658

5759
@Ignore("Remove to run test")
5860
@Test
5961
public void testEncodeAllTheLetters() {
60-
assertEquals("gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt",
61-
atbash.encode("The quick brown fox jumps over the lazy dog."));
62+
assertThat(atbash.encode("The quick brown fox jumps over the lazy dog."))
63+
.isEqualTo("gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt");
6264
}
6365

6466
@Ignore("Remove to run test")
6567
@Test
6668
public void testDecodeExercism() {
67-
assertEquals("exercism", atbash.decode("vcvix rhn"));
69+
assertThat(atbash.decode("vcvix rhn")).isEqualTo("exercism");
6870
}
6971

7072
@Ignore("Remove to run test")
7173
@Test
7274
public void testDecodeASentence() {
73-
assertEquals("anobstacleisoftenasteppingstone", atbash.decode("zmlyh gzxov rhlug vmzhg vkkrm thglm v"));
75+
assertThat(atbash.decode("zmlyh gzxov rhlug vmzhg vkkrm thglm v"))
76+
.isEqualTo("anobstacleisoftenasteppingstone");
7477
}
7578

7679
@Ignore("Remove to run test")
7780
@Test
7881
public void testDecodeNumbers() {
79-
assertEquals("testing123testing", atbash.decode("gvhgr mt123 gvhgr mt"));
82+
assertThat(atbash.decode("gvhgr mt123 gvhgr mt"))
83+
.isEqualTo("testing123testing");
8084
}
8185

8286
@Ignore("Remove to run test")
8387
@Test
8488
public void testDecodeAllTheLetters() {
85-
assertEquals("thequickbrownfoxjumpsoverthelazydog",
86-
atbash.decode("gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt"));
89+
assertThat(atbash.decode("gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt"))
90+
.isEqualTo("thequickbrownfoxjumpsoverthelazydog");
8791
}
88-
92+
8993
@Ignore("Remove to run test")
9094
@Test
9195
public void testDecodeWithTooManySpaces() {
92-
assertEquals("exercism", atbash.decode("vc vix r hn"));
96+
assertThat(atbash.decode("vc vix r hn")).isEqualTo("exercism");
9397
}
94-
98+
9599
@Ignore("Remove to run test")
96100
@Test
97101
public void testDecodeWithNoSpaces() {
98-
assertEquals("anobstacleisoftenasteppingstone",
99-
atbash.decode("zmlyhgzxovrhlugvmzhgvkkrmthglmv"));
102+
assertThat(atbash.decode("zmlyhgzxovrhlugvmzhgvkkrmthglmv"))
103+
.isEqualTo("anobstacleisoftenasteppingstone");
100104
}
101105
}

0 commit comments

Comments
 (0)