@@ -14,17 +14,17 @@ private static void check(@NotNull String expected, @NotNull String actual) {
14
14
15
15
@ Test
16
16
public void testSimple () {
17
- var formatter = new TextFormatter ("Hello World" ).concat ("!" );
17
+ var formatter = TextFormatter . of ("Hello World" ).concat ("!" );
18
18
check ("Hello World!" , formatter .toString ());
19
19
}
20
20
21
21
@ Test
22
22
public void testSubFormatters () {
23
- var formatter = new TextFormatter ("Hello World" )
23
+ var formatter = TextFormatter . of ("Hello World" )
24
24
.concat ("! " )
25
25
.concat (
26
- new TextFormatter ("(Here is a sub-formatter" )
27
- .concat (new TextFormatter (" (with another" ).concat (" sub-formatter)" ))
26
+ TextFormatter . of ("(Here is a sub-formatter" )
27
+ .concat (TextFormatter . of (" (with another" ).concat (" sub-formatter)" ))
28
28
.concat (")" )
29
29
)
30
30
.concat ("!" );
@@ -34,10 +34,10 @@ public void testSubFormatters() {
34
34
35
35
@ Test
36
36
public void testForegroundColoring () {
37
- var formatter = new TextFormatter ("red text here, " , Color .RED )
37
+ var formatter = TextFormatter . of ("red text here, " , Color .RED )
38
38
.concat (
39
- new TextFormatter ("blue text here, " , Color .BLUE )
40
- .concat (new TextFormatter ("now yellow" , Color .BRIGHT_YELLOW ))
39
+ TextFormatter . of ("blue text here, " , Color .BLUE )
40
+ .concat (TextFormatter . of ("now yellow" , Color .BRIGHT_YELLOW ))
41
41
.concat (" and back to blue" )
42
42
)
43
43
.concat (". back to red" );
@@ -51,13 +51,13 @@ public void testForegroundColoring() {
51
51
52
52
@ Test
53
53
public void testBackgroundColoring () {
54
- var formatter = new TextFormatter ("red background here, " )
54
+ var formatter = TextFormatter . of ("red background here, " )
55
55
.withBackgroundColor (Color .RED )
56
56
.concat (
57
- new TextFormatter ("blue background here, " )
57
+ TextFormatter . of ("blue background here, " )
58
58
.withBackgroundColor (Color .BLUE )
59
59
.concat (
60
- new TextFormatter ("now yellow" )
60
+ TextFormatter . of ("now yellow" )
61
61
.withBackgroundColor (Color .BRIGHT_YELLOW )
62
62
)
63
63
.concat (" and back to blue" )
@@ -74,9 +74,9 @@ public void testBackgroundColoring() {
74
74
75
75
@ Test
76
76
public void testMiddleBackground () {
77
- var formatter = new TextFormatter ("yellow " , Color .BRIGHT_YELLOW )
77
+ var formatter = TextFormatter . of ("yellow " , Color .BRIGHT_YELLOW )
78
78
.concat (
79
- new TextFormatter ("blue " )
79
+ TextFormatter . of ("blue " )
80
80
.withBackgroundColor (Color .BLUE )
81
81
)
82
82
.concat (" and back to yellow" );
@@ -90,10 +90,10 @@ public void testMiddleBackground() {
90
90
91
91
@ Test
92
92
public void testEmpty () {
93
- var formatter = new TextFormatter ("parent start. " , Color .RED )
93
+ var formatter = TextFormatter . of ("parent start. " , Color .RED )
94
94
.concat (
95
- new TextFormatter ("red text here, " )
96
- .concat (new TextFormatter ().addFormat (FormatOption .ITALIC ).concat ("subsub" ))
95
+ TextFormatter . of ("red text here, " )
96
+ .concat (TextFormatter . create ().addFormat (FormatOption .ITALIC ).concat ("subsub" ))
97
97
).concat (" end str" );
98
98
99
99
check (
@@ -105,6 +105,6 @@ public void testEmpty() {
105
105
106
106
@ Test
107
107
public void testStartWithDefault () {
108
- check (Color .BRIGHT_WHITE + "test" , new TextFormatter ("test" , Color .BRIGHT_WHITE ).toString ());
108
+ check (Color .BRIGHT_WHITE + "test" , TextFormatter . of ("test" , Color .BRIGHT_WHITE ).toString ());
109
109
}
110
- }
110
+ }
0 commit comments