1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package org.basepom.mojo.propertyhelper;
16
17 import static org.junit.jupiter.api.Assertions.assertEquals;
18
19 import java.util.function.Function;
20
21 import org.junit.jupiter.api.Test;
22
23 public class TestTransformerRegistry {
24
25 @Test
26 public void testLowercase() {
27 final Function<String, String> transformer = TransformerRegistry.INSTANCE.forName("lowercase");
28
29 assertEquals(" hello, world! ", transformer.apply(" Hello, World! "));
30 }
31
32 @Test
33 public void testUppercase() {
34 final Function<String, String> transformer = TransformerRegistry.INSTANCE.forName("uppercase");
35
36 assertEquals(" HELLO, WORLD! ", transformer.apply(" Hello, World! "));
37 }
38
39 @Test
40 public void testRemoveWhitespace() {
41 final Function<String, String> transformer = TransformerRegistry.INSTANCE.forName("remove_whitespace");
42
43 assertEquals("Hello,World!", transformer.apply(" Hello, World! "));
44 }
45
46 @Test
47 public void testUnderscoreForWhitespace() {
48 final Function<String, String> transformer = TransformerRegistry.INSTANCE.forName("underscore_for_whitespace");
49
50 assertEquals("_Hello,_World!_", transformer.apply(" Hello, World! "));
51 }
52
53 @Test
54 public void testDashForWhitespace() {
55 final Function<String, String> transformer = TransformerRegistry.INSTANCE.forName("dash_for_whitespace");
56
57 assertEquals("-Hello,-World!-", transformer.apply(" Hello, World! "));
58 }
59
60 @Test
61 public void testUseUnderscore() {
62 final Function<String, String> transformer = TransformerRegistry.INSTANCE.forName("use_underscore");
63
64 assertEquals("_This:_Is_a_test!", transformer.apply(" This: Is_a-test!"));
65 }
66
67 @Test
68 public void testUseDash() {
69 final Function<String, String> transformer = TransformerRegistry.INSTANCE.forName("use_dash");
70
71 assertEquals("-This:-Is-a-test!", transformer.apply(" This: Is_a-test!"));
72 }
73
74 @Test
75 public void testTrim() {
76 final Function<String, String> transformer = TransformerRegistry.INSTANCE.forName("trim");
77
78 assertEquals("Hello, World!", transformer.apply(" Hello, World! "));
79 }
80 }