Skip to content

Commit 865c4df

Browse files
committed
fix test
Signed-off-by: Stefan Niederhauser <[email protected]>
1 parent 1a5baaa commit 865c4df

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

graphviz-java/src/main/java/guru/nidi/graphviz/model/Serializer.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@ private void toplevelGraph(MutableGraph graph) {
4141
if (!graph.name.isEmpty()) {
4242
str.append(SimpleLabel.of(graph.name).serialized()).append(' ');
4343
}
44-
str.append("{\n");
4544
doGraph(graph, useDir);
46-
str.append('}');
4745
}
4846

4947
private void subGraph(MutableGraph graph, boolean useDir) {
@@ -52,12 +50,11 @@ private void subGraph(MutableGraph graph, boolean useDir) {
5250
.append(Label.of((graph.cluster ? "cluster_" : "") + graph.name).serialized())
5351
.append(' ');
5452
}
55-
str.append("{\n");
5653
doGraph(graph, useDir);
57-
str.append('}');
5854
}
5955

6056
private void doGraph(MutableGraph graph, boolean useDir) {
57+
str.append("{\n");
6158
if (useDir && graph.graphAttrs.get("dir") == null) {
6259
attributes("edge", Attributes.attr("dir", graph.directed ? "forward" : "none"));
6360
}
@@ -86,6 +83,7 @@ private void doGraph(MutableGraph graph, boolean useDir) {
8683

8784
edges(nodes, useDir);
8885
edges(graphs, useDir);
86+
str.append('}');
8987
}
9088

9189
private boolean hasDifferentlyDirectedSubgraphs(MutableGraph graph) {

graphviz-java/src/test/java/guru/nidi/graphviz/CodeAnalysisTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ protected PmdResult analyzePmd() {
8989
.ignore("JUnitTestsShouldIncludeAssert", "LocalVariableCouldBeFinal", "UnusedLocalVariable"))
9090
.because("It's a test", In.loc("*Test")
9191
.ignore("ExcessiveMethodLength"))
92-
.because("It's a bug in PMD?", In.clazz(MutableNode.class).ignore("ConstructorCallsOverridableMethod"))
92+
.because("It's a bug in PMD?",
93+
In.clazz(MutableNode.class).ignore("ConstructorCallsOverridableMethod"),
94+
In.loc("Serializer#doGraph").ignore("ConsecutiveLiteralAppends"))
9395
.because("There are a lot of colors", In.clazz(Color.class)
9496
.ignore("FieldDeclarationsShouldBeAtStartOfClass"))
9597
.because("it's ok here",
@@ -129,7 +131,7 @@ protected CpdResult analyzeCpd() {
129131
.apply(PmdConfigs.cpdIgnoreEqualsHashCodeToString())
130132
.because("It's java",
131133
In.loc("*Graph").ignore("Graph(strict, directed, cluster, name,", "if (strict != graph.strict) {"))
132-
.just(In.locs("GraphvizGraalEngine","GraphvizNashornEngine").ignore("void doInit()"));
134+
.just(In.locs("GraphvizGraalEngine", "GraphvizNashornEngine").ignore("void doInit()"));
133135
return new CpdAnalyzer(AnalyzerConfig.maven().main(), 36, collector).analyze();
134136
}
135137

0 commit comments

Comments
 (0)