10
10
class DescriptionsUtilsTest {
11
11
@ Test
12
12
void testExtractNotes_singleNote () {
13
- String description = "> NOTE: This is a note.\n > Continued on the next line." ;
14
- List <String > notes = DescriptionsUtils .notes ( description );
13
+ final String description = "> NOTE: This is a note.\n > Continued on the next line." ;
14
+ final List <String > notes = DescriptionsUtils .notes ( description );
15
15
assertEquals ( 1 , notes .size () );
16
16
assertEquals ( "This is a note.\n Continued on the next line." , notes .get ( 0 ) );
17
17
}
18
18
19
19
@ Test
20
20
void testExtractExamples_multipleExamples () {
21
- String description =
22
- "> EXAMPLE 1: First example.\n > More detail.\n " +
23
- "> EXAMPLE 2: Second example." ;
24
- List <String > examples = DescriptionsUtils .examples ( description );
21
+ final String description =
22
+ """
23
+ > EXAMPLE 1: First example.
24
+ > More detail.
25
+
26
+ > EXAMPLE 2: Second example.
27
+ """ ;
28
+ final List <String > examples = DescriptionsUtils .examples ( description );
25
29
26
30
assertEquals ( 2 , examples .size () );
27
31
assertEquals ( "First example.\n More detail." , examples .get ( 0 ) );
@@ -30,26 +34,29 @@ void testExtractExamples_multipleExamples() {
30
34
31
35
@ Test
32
36
void testExtractSources_withLink () {
33
- String description = "> SOURCE: Source with [link](https://example.com)" ;
34
- List <String > sources = DescriptionsUtils .sources ( description );
37
+ final String description = "> SOURCE: Source with [link](https://example.com)" ;
38
+ final List <String > sources = DescriptionsUtils .sources ( description );
35
39
assertEquals ( 1 , sources .size () );
36
40
assertTrue ( sources .get ( 0 ).contains ( "[link](https://example.com)" ) );
37
41
}
38
42
39
43
@ Test
40
44
void testMixedBlockTypes () {
41
- String description =
42
- "> NOTE: A note block.\n " +
43
- "> EXAMPLE: An example block.\n " +
44
- "> SOURCE: A source block." ;
45
+ final String description =
46
+ """
47
+ > NOTE: A note block.
48
+ > EXAMPLE: An example block.
49
+
50
+ > SOURCE: A source block.
51
+ """ ;
45
52
assertEquals ( 1 , DescriptionsUtils .notes ( description ).size () );
46
53
assertEquals ( 1 , DescriptionsUtils .examples ( description ).size () );
47
54
assertEquals ( 1 , DescriptionsUtils .sources ( description ).size () );
48
55
}
49
56
50
57
@ Test
51
58
void testNoBlocks () {
52
- String description = "This is a plain description without any special blocks." ;
59
+ final String description = "This is a plain description without any special blocks." ;
53
60
assertTrue ( DescriptionsUtils .notes ( description ).isEmpty () );
54
61
assertTrue ( DescriptionsUtils .examples ( description ).isEmpty () );
55
62
assertTrue ( DescriptionsUtils .sources ( description ).isEmpty () );
@@ -72,8 +79,7 @@ void testToHtml_withAllBlockTypes() {
72
79
Some **markdown** content here.
73
80
1. Ordered
74
81
2. List
75
- """
76
- ;
82
+ """ ;
77
83
78
84
final String html = DescriptionsUtils .toHtml ( description );
79
85
0 commit comments