forked from utPLSQL/utPLSQL-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringBlockFormatterTest.java
More file actions
55 lines (41 loc) · 1.67 KB
/
StringBlockFormatterTest.java
File metadata and controls
55 lines (41 loc) · 1.67 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 org.utplsql.cli;
import org.junit.jupiter.api.Test;
import org.utplsql.cli.log.StringBlockFormatter;
import static org.junit.jupiter.api.Assertions.assertEquals;
class StringBlockFormatterTest {
@Test
void getBlockFormattedString() {
String expected =
"#### Headline ####\n" +
"# #\n" +
"# My value 1 #\n" +
"# My val 2 #\n" +
"# #\n" +
"##################";
StringBlockFormatter formatter = new StringBlockFormatter("Headline");
formatter.appendLine("My value 1");
formatter.appendLine("My val 2");
assertEquals( expected, formatter.toString() );
}
@Test
void getEncapsulatedLine() {
String line = StringBlockFormatter.getEncapsulatedLine("val 1", 20);
assertEquals("# val 1 #", line);
}
@Test
void getEncapsulatedHeadline() {
assertEquals("######### headline #########",
StringBlockFormatter.getEncapsulatedHeadline("headline", 20));
assertEquals("######### headline ##########",
StringBlockFormatter.getEncapsulatedHeadline("headline", 21));
assertEquals("######### headline1 #########",
StringBlockFormatter.getEncapsulatedHeadline("headline1", 21));
assertEquals("######## headline1 #########",
StringBlockFormatter.getEncapsulatedHeadline("headline1", 20));
}
@Test
void getEmptyEncapsulatedHeadline() {
assertEquals("##################",
StringBlockFormatter.getEncapsulatedHeadline("", 10));
}
}