Skip to content

Commit

Permalink
Use raw true/false in JSON output
Browse files Browse the repository at this point in the history
  • Loading branch information
jeantessier committed Oct 21, 2024
1 parent f8b59dc commit ab5bc99
Show file tree
Hide file tree
Showing 46 changed files with 49 additions and 48 deletions.
8 changes: 4 additions & 4 deletions lib/src/main/java/com/jeantessier/dependency/JSONPrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ private String printNode(Node node) {
}

private String printPackageNode(PackageNode packageNode) {
return "{\"type\":\"package\",\"confirmed\":\"" + packageNode.isConfirmed() + "\",\"name\":\"" + packageNode.getName() + "\",\"outbound\":" + (isShowOutbounds() ? printDependencyNodes(packageNode.getOutboundDependencies()) : "[]") + ",\"inbound\":" + (isShowInbounds() ? printDependencyNodes(packageNode.getInboundDependencies()) : "[]") + ",\"classes\":" + printNodes(packageNode.getClasses()) + "}";
return "{\"type\":\"package\",\"confirmed\":" + packageNode.isConfirmed() + ",\"name\":\"" + packageNode.getName() + "\",\"outbound\":" + (isShowOutbounds() ? printDependencyNodes(packageNode.getOutboundDependencies()) : "[]") + ",\"inbound\":" + (isShowInbounds() ? printDependencyNodes(packageNode.getInboundDependencies()) : "[]") + ",\"classes\":" + printNodes(packageNode.getClasses()) + "}";
}

private String printClassNode(ClassNode classNode) {
return "{\"type\":\"class\",\"confirmed\":\"" + classNode.isConfirmed() + "\",\"name\":\"" + classNode.getName() + "\",\"outbound\":" + (isShowOutbounds() ? printDependencyNodes(classNode.getOutboundDependencies()) : "[]") + ",\"inbound\":" + (isShowInbounds() ? printDependencyNodes(classNode.getInboundDependencies()) : "[]") + ",\"features\":" + printNodes(classNode.getFeatures()) + "}";
return "{\"type\":\"class\",\"confirmed\":" + classNode.isConfirmed() + ",\"name\":\"" + classNode.getName() + "\",\"outbound\":" + (isShowOutbounds() ? printDependencyNodes(classNode.getOutboundDependencies()) : "[]") + ",\"inbound\":" + (isShowInbounds() ? printDependencyNodes(classNode.getInboundDependencies()) : "[]") + ",\"features\":" + printNodes(classNode.getFeatures()) + "}";
}

private String printFeatureNode(FeatureNode featureNode) {
return "{\"type\":\"feature\",\"confirmed\":\"" + featureNode.isConfirmed() + "\",\"name\":\"" + featureNode.getName() + "\",\"outbound\":" + (isShowOutbounds() ? printDependencyNodes(featureNode.getOutboundDependencies()) : "[]") + ",\"inbound\":" + (isShowInbounds() ? printDependencyNodes(featureNode.getInboundDependencies()) : "[]") + "}";
return "{\"type\":\"feature\",\"confirmed\":" + featureNode.isConfirmed() + ",\"name\":\"" + featureNode.getName() + "\",\"outbound\":" + (isShowOutbounds() ? printDependencyNodes(featureNode.getOutboundDependencies()) : "[]") + ",\"inbound\":" + (isShowInbounds() ? printDependencyNodes(featureNode.getInboundDependencies()) : "[]") + "}";
}

public String printDependencyNodes(Collection<? extends Node> nodes) {
Expand All @@ -72,6 +72,6 @@ private String printDependencyNode(Node node) {
}

private String printDependency(Node node, String type) {
return "{\"type\":\"" + type + "\",\"confirmed\":\"" + node.isConfirmed() + "\",\"name\":\"" + node.getName() + "\"}";
return "{\"type\":\"" + type + "\",\"confirmed\":" + node.isConfirmed() + ",\"name\":\"" + node.getName() + "\"}";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ void generateReportAndCompareToFile(String variation, DependencyGraph dependency

// When
visitor.traverseNodes(factory.getPackages().values());
visitor.eol();

// Then
var expectedReport = Files.readString(REPORTS_DIR.resolve(expectedOutput));
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"type":"package","confirmed":"true","name":"inbound","outbound":[],"inbound":[{"type":"package","confirmed":"true","name":"outbound"}],"classes":[{"type":"class","confirmed":"true","name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":"true","name":"outbound.Outbound"}],"features":[{"type":"feature","confirmed":"true","name":"inbound.Inbound.inbound()","outbound":[],"inbound":[{"type":"feature","confirmed":"true","name":"outbound.Outbound.outbound()"}]}]}]},{"type":"package","confirmed":"true","name":"outbound","outbound":[{"type":"package","confirmed":"true","name":"inbound"}],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"outbound.Outbound","outbound":[{"type":"class","confirmed":"true","name":"inbound.Inbound"}],"inbound":[],"features":[{"type":"feature","confirmed":"true","name":"outbound.Outbound.outbound()","outbound":[{"type":"feature","confirmed":"true","name":"inbound.Inbound.inbound()"}],"inbound":[]}]}]}]
[{"type":"package","confirmed":true,"name":"inbound","outbound":[],"inbound":[{"type":"package","confirmed":true,"name":"outbound"}],"classes":[{"type":"class","confirmed":true,"name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":true,"name":"outbound.Outbound"}],"features":[{"type":"feature","confirmed":true,"name":"inbound.Inbound.inbound()","outbound":[],"inbound":[{"type":"feature","confirmed":true,"name":"outbound.Outbound.outbound()"}]}]}]},{"type":"package","confirmed":true,"name":"outbound","outbound":[{"type":"package","confirmed":true,"name":"inbound"}],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"outbound.Outbound","outbound":[{"type":"class","confirmed":true,"name":"inbound.Inbound"}],"inbound":[],"features":[{"type":"feature","confirmed":true,"name":"outbound.Outbound.outbound()","outbound":[{"type":"feature","confirmed":true,"name":"inbound.Inbound.inbound()"}],"inbound":[]}]}]}]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"type":"package","confirmed":"true","name":"empty","outbound":[],"inbound":[],"classes":[]},{"type":"package","confirmed":"true","name":"inbound","outbound":[],"inbound":[{"type":"package","confirmed":"true","name":"outbound"}],"classes":[{"type":"class","confirmed":"true","name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":"true","name":"outbound.Outbound"}],"features":[{"type":"feature","confirmed":"true","name":"inbound.Inbound.inbound()","outbound":[],"inbound":[{"type":"feature","confirmed":"true","name":"outbound.Outbound.outbound()"}]}]}]},{"type":"package","confirmed":"true","name":"outbound","outbound":[{"type":"package","confirmed":"true","name":"inbound"}],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"outbound.Outbound","outbound":[{"type":"class","confirmed":"true","name":"inbound.Inbound"}],"inbound":[],"features":[{"type":"feature","confirmed":"true","name":"outbound.Outbound.outbound()","outbound":[{"type":"feature","confirmed":"true","name":"inbound.Inbound.inbound()"}],"inbound":[]}]}]}]
[{"type":"package","confirmed":true,"name":"empty","outbound":[],"inbound":[],"classes":[]},{"type":"package","confirmed":true,"name":"inbound","outbound":[],"inbound":[{"type":"package","confirmed":true,"name":"outbound"}],"classes":[{"type":"class","confirmed":true,"name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":true,"name":"outbound.Outbound"}],"features":[{"type":"feature","confirmed":true,"name":"inbound.Inbound.inbound()","outbound":[],"inbound":[{"type":"feature","confirmed":true,"name":"outbound.Outbound.outbound()"}]}]}]},{"type":"package","confirmed":true,"name":"outbound","outbound":[{"type":"package","confirmed":true,"name":"inbound"}],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"outbound.Outbound","outbound":[{"type":"class","confirmed":true,"name":"inbound.Inbound"}],"inbound":[],"features":[{"type":"feature","confirmed":true,"name":"outbound.Outbound.outbound()","outbound":[{"type":"feature","confirmed":true,"name":"inbound.Inbound.inbound()"}],"inbound":[]}]}]}]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"type":"package","confirmed":"false","name":"inbound","outbound":[],"inbound":[{"type":"package","confirmed":"false","name":"outbound"}],"classes":[{"type":"class","confirmed":"false","name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":"false","name":"outbound.Outbound"}],"features":[{"type":"feature","confirmed":"false","name":"inbound.Inbound.inbound()","outbound":[],"inbound":[{"type":"feature","confirmed":"false","name":"outbound.Outbound.outbound()"}]}]}]},{"type":"package","confirmed":"false","name":"outbound","outbound":[{"type":"package","confirmed":"false","name":"inbound"}],"inbound":[],"classes":[{"type":"class","confirmed":"false","name":"outbound.Outbound","outbound":[{"type":"class","confirmed":"false","name":"inbound.Inbound"}],"inbound":[],"features":[{"type":"feature","confirmed":"false","name":"outbound.Outbound.outbound()","outbound":[{"type":"feature","confirmed":"false","name":"inbound.Inbound.inbound()"}],"inbound":[]}]}]}]
[{"type":"package","confirmed":false,"name":"inbound","outbound":[],"inbound":[{"type":"package","confirmed":false,"name":"outbound"}],"classes":[{"type":"class","confirmed":false,"name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":false,"name":"outbound.Outbound"}],"features":[{"type":"feature","confirmed":false,"name":"inbound.Inbound.inbound()","outbound":[],"inbound":[{"type":"feature","confirmed":false,"name":"outbound.Outbound.outbound()"}]}]}]},{"type":"package","confirmed":false,"name":"outbound","outbound":[{"type":"package","confirmed":false,"name":"inbound"}],"inbound":[],"classes":[{"type":"class","confirmed":false,"name":"outbound.Outbound","outbound":[{"type":"class","confirmed":false,"name":"inbound.Inbound"}],"inbound":[],"features":[{"type":"feature","confirmed":false,"name":"outbound.Outbound.outbound()","outbound":[{"type":"feature","confirmed":false,"name":"inbound.Inbound.inbound()"}],"inbound":[]}]}]}]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"type":"package","confirmed":"false","name":"empty","outbound":[],"inbound":[],"classes":[]},{"type":"package","confirmed":"false","name":"inbound","outbound":[],"inbound":[{"type":"package","confirmed":"false","name":"outbound"}],"classes":[{"type":"class","confirmed":"false","name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":"false","name":"outbound.Outbound"}],"features":[{"type":"feature","confirmed":"false","name":"inbound.Inbound.inbound()","outbound":[],"inbound":[{"type":"feature","confirmed":"false","name":"outbound.Outbound.outbound()"}]}]}]},{"type":"package","confirmed":"false","name":"outbound","outbound":[{"type":"package","confirmed":"false","name":"inbound"}],"inbound":[],"classes":[{"type":"class","confirmed":"false","name":"outbound.Outbound","outbound":[{"type":"class","confirmed":"false","name":"inbound.Inbound"}],"inbound":[],"features":[{"type":"feature","confirmed":"false","name":"outbound.Outbound.outbound()","outbound":[{"type":"feature","confirmed":"false","name":"inbound.Inbound.inbound()"}],"inbound":[]}]}]}]
[{"type":"package","confirmed":false,"name":"empty","outbound":[],"inbound":[],"classes":[]},{"type":"package","confirmed":false,"name":"inbound","outbound":[],"inbound":[{"type":"package","confirmed":false,"name":"outbound"}],"classes":[{"type":"class","confirmed":false,"name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":false,"name":"outbound.Outbound"}],"features":[{"type":"feature","confirmed":false,"name":"inbound.Inbound.inbound()","outbound":[],"inbound":[{"type":"feature","confirmed":false,"name":"outbound.Outbound.outbound()"}]}]}]},{"type":"package","confirmed":false,"name":"outbound","outbound":[{"type":"package","confirmed":false,"name":"inbound"}],"inbound":[],"classes":[{"type":"class","confirmed":false,"name":"outbound.Outbound","outbound":[{"type":"class","confirmed":false,"name":"inbound.Inbound"}],"inbound":[],"features":[{"type":"feature","confirmed":false,"name":"outbound.Outbound.outbound()","outbound":[{"type":"feature","confirmed":false,"name":"inbound.Inbound.inbound()"}],"inbound":[]}]}]}]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"type":"package","confirmed":"true","name":"inbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":"true","name":"outbound.Outbound"}],"features":[]}]},{"type":"package","confirmed":"true","name":"outbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"outbound.Outbound","outbound":[{"type":"class","confirmed":"true","name":"inbound.Inbound"}],"inbound":[],"features":[]}]}]
[{"type":"package","confirmed":true,"name":"inbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":true,"name":"outbound.Outbound"}],"features":[]}]},{"type":"package","confirmed":true,"name":"outbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"outbound.Outbound","outbound":[{"type":"class","confirmed":true,"name":"inbound.Inbound"}],"inbound":[],"features":[]}]}]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"type":"package","confirmed":"true","name":"empty","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"empty.Empty","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":"true","name":"inbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":"true","name":"outbound.Outbound"}],"features":[]}]},{"type":"package","confirmed":"true","name":"outbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"outbound.Outbound","outbound":[{"type":"class","confirmed":"true","name":"inbound.Inbound"}],"inbound":[],"features":[]}]}]
[{"type":"package","confirmed":true,"name":"empty","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"empty.Empty","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":true,"name":"inbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":true,"name":"outbound.Outbound"}],"features":[]}]},{"type":"package","confirmed":true,"name":"outbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"outbound.Outbound","outbound":[{"type":"class","confirmed":true,"name":"inbound.Inbound"}],"inbound":[],"features":[]}]}]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"type":"package","confirmed":"true","name":"empty","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"empty.Empty","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":"true","name":"inbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"inbound.Inbound","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":"true","name":"outbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"outbound.Outbound","outbound":[],"inbound":[],"features":[]}]}]
[{"type":"package","confirmed":true,"name":"empty","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"empty.Empty","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":true,"name":"inbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"inbound.Inbound","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":true,"name":"outbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"outbound.Outbound","outbound":[],"inbound":[],"features":[]}]}]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"type":"package","confirmed":"true","name":"empty","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"empty.Empty","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":"true","name":"inbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":"true","name":"outbound.Outbound"}],"features":[]}]},{"type":"package","confirmed":"true","name":"outbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"outbound.Outbound","outbound":[],"inbound":[],"features":[]}]}]
[{"type":"package","confirmed":true,"name":"empty","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"empty.Empty","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":true,"name":"inbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":true,"name":"outbound.Outbound"}],"features":[]}]},{"type":"package","confirmed":true,"name":"outbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"outbound.Outbound","outbound":[],"inbound":[],"features":[]}]}]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"type":"package","confirmed":"true","name":"empty","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"empty.Empty","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":"true","name":"inbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"inbound.Inbound","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":"true","name":"outbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"outbound.Outbound","outbound":[],"inbound":[],"features":[]}]}]
[{"type":"package","confirmed":true,"name":"empty","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"empty.Empty","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":true,"name":"inbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"inbound.Inbound","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":true,"name":"outbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"outbound.Outbound","outbound":[],"inbound":[],"features":[]}]}]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"type":"package","confirmed":"true","name":"empty","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"empty.Empty","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":"true","name":"inbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"inbound.Inbound","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":"true","name":"outbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"true","name":"outbound.Outbound","outbound":[{"type":"class","confirmed":"true","name":"inbound.Inbound"}],"inbound":[],"features":[]}]}]
[{"type":"package","confirmed":true,"name":"empty","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"empty.Empty","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":true,"name":"inbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"inbound.Inbound","outbound":[],"inbound":[],"features":[]}]},{"type":"package","confirmed":true,"name":"outbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":true,"name":"outbound.Outbound","outbound":[{"type":"class","confirmed":true,"name":"inbound.Inbound"}],"inbound":[],"features":[]}]}]
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[{"type":"package","confirmed":"false","name":"inbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"false","name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":"false","name":"outbound.Outbound"}],"features":[]}]},{"type":"package","confirmed":"false","name":"outbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":"false","name":"outbound.Outbound","outbound":[{"type":"class","confirmed":"false","name":"inbound.Inbound"}],"inbound":[],"features":[]}]}]
[{"type":"package","confirmed":false,"name":"inbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":false,"name":"inbound.Inbound","outbound":[],"inbound":[{"type":"class","confirmed":false,"name":"outbound.Outbound"}],"features":[]}]},{"type":"package","confirmed":false,"name":"outbound","outbound":[],"inbound":[],"classes":[{"type":"class","confirmed":false,"name":"outbound.Outbound","outbound":[{"type":"class","confirmed":false,"name":"inbound.Inbound"}],"inbound":[],"features":[]}]}]
Loading

0 comments on commit ab5bc99

Please sign in to comment.