-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathBuildClassDiagramTaskTest.groovy
82 lines (78 loc) · 3.94 KB
/
BuildClassDiagramTaskTest.groovy
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package com.github.roroche.plantuml
import com.github.roroche.plantuml.assertions.CreateTaskAssertion
import com.github.roroche.plantuml.assertions.CreatedTask
import com.github.roroche.plantuml.assertions.ExecuteTaskAssertion
import com.github.roroche.plantuml.assertions.GrvFileHasContentAssertion
import com.github.roroche.plantuml.tasks.ClassDiagramExtension
import com.pragmaticobjects.oo.tests.TestCase
import com.pragmaticobjects.oo.tests.junit5.TestsSuite
import org.gradle.testfixtures.ProjectBuilder
import org.junit.jupiter.api.io.TempDir
import java.nio.file.Path
/**
* TestsSuite that performs checks about BuildClassDiagramTask.
*/
class BuildClassDiagramTaskTest extends TestsSuite {
BuildClassDiagramTaskTest() {
super(
new TestCase(
"test buildClassDiagramTask",
new CreateTaskAssertion(
new CreatedTask(
ProjectBuilder.builder().build(),
"buildClassDiagramTask",
MockBuildClassDiagramTask.class,
new ClassDiagramExtension(
"com.github.roroche.examples",
tmpDirPath.resolve("output.txt").toFile(),
new ArrayList<String>()
)
),
MockBuildClassDiagramTask.class
)
),
new TestCase(
"test buildClassDiagramTask print diagram to file",
new ExecuteTaskAssertion(
new CreatedTask(
ProjectBuilder.builder().build(),
"buildClassDiagramTask",
MockBuildClassDiagramTask.class,
new ClassDiagramExtension(
"com.github.roroche.examples",
tmpDirPath.resolve("output.txt").toFile(),
new ArrayList<String>()
)
),
new GrvFileHasContentAssertion(
tmpDirPath.resolve("output.txt").toFile(),
"@startuml\n" +
"\n" +
"class \"Car\" {\n" +
" brand : String\n" +
" model : String\n" +
" driver : Driver\n" +
"}\n" +
"\n" +
"class \"Driver\" {\n" +
" name : String\n" +
" cars : List<Car>\n" +
"}\n" +
"\n" +
"interface \"Vehicle\"\n" +
"\n" +
"\"Car\" \"*\" <-> \"Driver\" : driver/cars\n" +
"\"Vehicle\" <|-- \"Car\"\n" +
"\n" +
"@enduml".trim()
)
)
)
)
}
/**
* Tmp dir path.
*/
@TempDir
public static Path tmpDirPath
}