Skip to content
Snippets Groups Projects
Commit 5e0a3728 authored by René Schöne's avatar René Schöne
Browse files

2.0.0

- add named exception for terminal dump methods
- new major version as non-backwards compatible
parent 5951632f
No related branches found
No related tags found
No related merge requests found
Pipeline #14580 skipped
Showing
with 138 additions and 112 deletions
...@@ -666,19 +666,28 @@ public class DumpBuilder { ...@@ -666,19 +666,28 @@ public class DumpBuilder {
// --- Dump methods --- // --- Dump methods ---
/**
* Return content as plantuml source code.
*
* @return the plantuml source code
* @throws TransformationException if {@link DumpAst#transform(TransformationTransferInformation, Object) transform} was not successful
*/
public String dumpAsSource() throws TransformationException {
return build().toPlantUml();
}
/** /**
* Write out content as plantuml source code. * Write out content as plantuml source code.
* *
* @param destination path of destination file * @param destination path of destination file
* @return this * @throws IOException if an I/O error happened during opening or writing in that file
* @throws java.io.IOException if an I/O error happened during opening or writing in that file * @throws TransformationException if {@link DumpAst#transform(TransformationTransferInformation, Object) transform} was not successful
*/ */
public DumpBuilder dumpAsSource(Path destination) throws java.io.IOException { public void dumpAsSource(Path destination) throws IOException, TransformationException {
String content = build().toPlantUml(); String content = build().toPlantUml();
try (Writer writer = Files.newBufferedWriter(destination)) { try (Writer writer = Files.newBufferedWriter(destination)) {
writer.write(content); writer.write(content);
} }
return this;
} }
/** /**
...@@ -686,39 +695,36 @@ public class DumpBuilder { ...@@ -686,39 +695,36 @@ public class DumpBuilder {
* *
* @param destination path of destination file * @param destination path of destination file
* @param prependCreationComment whether to add the creation date as first line * @param prependCreationComment whether to add the creation date as first line
* @return this * @throws IOException if an I/O error happened during opening or writing in that file
* @throws java.io.IOException if an I/O error happened during opening or writing in that file * @throws TransformationException if {@link DumpAst#transform(TransformationTransferInformation, Object) transform} was not successful
*/ */
public DumpBuilder dumpAsYaml(Path destination, boolean prependCreationComment) throws java.io.IOException { public void dumpAsYaml(Path destination, boolean prependCreationComment) throws IOException, TransformationException {
String content = build().printYaml(prependCreationComment); String content = build().printYaml(prependCreationComment);
try (Writer writer = Files.newBufferedWriter(destination)) { try (Writer writer = Files.newBufferedWriter(destination)) {
writer.write(content); writer.write(content);
} }
return this;
} }
/** /**
* Write out content as PNG image generated by plantuml. * Write out content as PNG image generated by plantuml.
* *
* @param destination path of destination file * @param destination path of destination file
* @return this * @throws IOException if an I/O error happened during opening or writing in that file
* @throws java.io.IOException if an I/O error happened during opening or writing in that file * @throws TransformationException if {@link DumpAst#transform(TransformationTransferInformation, Object) transform} was not successful
*/ */
public DumpBuilder dumpAsPNG(Path destination) throws java.io.IOException { public void dumpAsPNG(Path destination) throws IOException, TransformationException {
dumpAs(destination, FileFormat.PNG); dumpAs(destination, FileFormat.PNG);
return this;
} }
/** /**
* Write out content as SVG image generated by plantuml. * Write out content as SVG image generated by plantuml.
* *
* @param destination path of destination file * @param destination path of destination file
* @return this * @throws IOException if an I/O error happened during opening or writing in that file
* @throws java.io.IOException if an I/O error happened during opening or writing in that file * @throws TransformationException if {@link DumpAst#transform(TransformationTransferInformation, Object) transform} was not successful
*/ */
public DumpBuilder dumpAsSVG(Path destination) throws java.io.IOException { public void dumpAsSVG(Path destination) throws IOException, TransformationException {
dumpAs(destination, FileFormat.SVG); dumpAs(destination, FileFormat.SVG);
return this;
} }
/** /**
...@@ -728,15 +734,14 @@ public class DumpBuilder { ...@@ -728,15 +734,14 @@ public class DumpBuilder {
* <b>Note:</b> This requires additional dependencies, see <a href="https://plantuml.com/pdf">https://plantuml.com/pdf</a> * <b>Note:</b> This requires additional dependencies, see <a href="https://plantuml.com/pdf">https://plantuml.com/pdf</a>
* *
* @param destination path of destination file * @param destination path of destination file
* @return this * @throws IOException if an I/O error happened during opening or writing in that file
* @throws java.io.IOException if an I/O error happened during opening or writing in that file * @throws TransformationException if {@link DumpAst#transform(TransformationTransferInformation, Object) transform} was not successful
*/ */
public DumpBuilder dumpAsPDF(Path destination) throws java.io.IOException { public void dumpAsPDF(Path destination) throws IOException, TransformationException {
dumpAs(destination, FileFormat.PDF); dumpAs(destination, FileFormat.PDF);
return this;
} }
private void dumpAs(Path destination, FileFormat fileFormat) throws IOException { private void dumpAs(Path destination, FileFormat fileFormat) throws IOException, TransformationException {
String content = build().toPlantUml(); String content = build().toPlantUml();
SourceStringReader reader = new SourceStringReader(content); SourceStringReader reader = new SourceStringReader(content);
reader.outputImage(Files.newOutputStream(destination), new FileFormatOption(fileFormat)); reader.outputImage(Files.newOutputStream(destination), new FileFormatOption(fileFormat));
...@@ -744,7 +749,7 @@ public class DumpBuilder { ...@@ -744,7 +749,7 @@ public class DumpBuilder {
// --- Helper methods --- // --- Helper methods ---
protected DumpAst build() { protected DumpAst build() throws TransformationException {
if (result == null) { if (result == null) {
result = new DumpAst(); result = new DumpAst();
final String packageNameToUse; final String packageNameToUse;
...@@ -763,7 +768,8 @@ public class DumpBuilder { ...@@ -763,7 +768,8 @@ public class DumpBuilder {
try { try {
result.transform(new TransformationTransferInformation(), this.target); result.transform(new TransformationTransferInformation(), this.target);
} catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) { } catch (InvocationTargetException | IllegalAccessException | NoSuchMethodException e) {
throw new RuntimeException("Could not transform :(", e); result = null;
throw new TransformationException(e);
} }
} }
return result; return result;
......
package de.tudresden.inf.st.jastadd.dumpAst.ast;
/**
* Exception when transformation was unsuccessful.
*
* @author rschoene - Initial contribution
*/
public class TransformationException extends Exception {
public TransformationException(Throwable cause) {
super("Could not transform :(", cause);
}
}
#Tue Sep 06 14:11:59 CEST 2022 #Thu Sep 08 16:46:11 CEST 2022
version=1.2.2 version=2.0.0
package de.tudresden.inf.st.jastadd.featureTest; package de.tudresden.inf.st.jastadd.featureTest;
import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpBuilder;
import de.tudresden.inf.st.jastadd.dumpAst.ast.Dumper; import de.tudresden.inf.st.jastadd.dumpAst.ast.Dumper;
import de.tudresden.inf.st.jastadd.dumpAst.ast.SkinParamBooleanSetting; import de.tudresden.inf.st.jastadd.dumpAst.ast.SkinParamBooleanSetting;
import de.tudresden.inf.st.jastadd.dumpAst.ast.TransformationException;
import org.jastadd.featureTest.ast.*; import org.jastadd.featureTest.ast.*;
import java.io.IOException; import java.io.IOException;
...@@ -15,7 +17,7 @@ import java.nio.file.Paths; ...@@ -15,7 +17,7 @@ import java.nio.file.Paths;
*/ */
public class FeatureTestMain { public class FeatureTestMain {
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException, TransformationException {
Root root = new Root(); Root root = new Root();
root.setName("Root1"); root.setName("Root1");
A a = new A().setName("A2"); A a = new A().setName("A2");
...@@ -38,9 +40,10 @@ public class FeatureTestMain { ...@@ -38,9 +40,10 @@ public class FeatureTestMain {
Path pathToYaml = Paths.get("featureTest.yml"); Path pathToYaml = Paths.get("featureTest.yml");
Path pathToPng = Paths.get("featureTest.png"); Path pathToPng = Paths.get("featureTest.png");
Path pathToSvg = Paths.get("featureTest.svg"); Path pathToSvg = Paths.get("featureTest.svg");
Dumper DumpBuilder builder = Dumper
// .read(null) // .read(null)
.read(root) .read(root)
// .enableRelationWithRank()
// .customPreamble("hide empty members") // .customPreamble("hide empty members")
.enableDebug() .enableDebug()
.customPreamble("title My fancy title") .customPreamble("title My fancy title")
...@@ -66,12 +69,11 @@ public class FeatureTestMain { ...@@ -66,12 +69,11 @@ public class FeatureTestMain {
} }
}) })
.skinParam(SkinParamBooleanSetting.Shadowing, false) .skinParam(SkinParamBooleanSetting.Shadowing, false)
.setNameMethod(node -> node.getClass().getSimpleName() + ASTNode.counter++) .setNameMethod(node -> node.getClass().getSimpleName() + ASTNode.counter++);
// .enableRelationWithRank()
.dumpAsYaml(pathToYaml, true) builder.dumpAsYaml(pathToYaml, true);
.dumpAsPNG(pathToPng) builder.dumpAsPNG(pathToPng);
.dumpAsSVG(pathToSvg) builder.dumpAsSVG(pathToSvg);
.dumpAsSource(Paths.get("featureTest.puml")) builder.dumpAsSource(Paths.get("featureTest.puml"));
;
} }
} }
package de.tudresden.inf.st.jastadd.testDumper; package de.tudresden.inf.st.jastadd.testDumper;
import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpNode; import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpNode;
import de.tudresden.inf.st.jastadd.dumpAst.ast.TransformationException;
import org.jastadd.testDumper.ast.DropOffLocation; import org.jastadd.testDumper.ast.DropOffLocation;
import org.jastadd.testDumper.ast.Orientation; import org.jastadd.testDumper.ast.Orientation;
import org.jastadd.testDumper.ast.Position; import org.jastadd.testDumper.ast.Position;
...@@ -20,7 +21,7 @@ import static org.assertj.core.api.Assertions.*; ...@@ -20,7 +21,7 @@ import static org.assertj.core.api.Assertions.*;
public class TestComplex { public class TestComplex {
@Test @Test
public void testRegressionIssue16() { public void testRegressionIssue16() throws TransformationException {
DropOffLocation location = new DropOffLocation(); DropOffLocation location = new DropOffLocation();
location.setName(ROOT_NAME); location.setName(ROOT_NAME);
location.setPosition(new Position(T1_NAME, 1, 2, 3)); location.setPosition(new Position(T1_NAME, 1, 2, 3));
......
...@@ -3,6 +3,7 @@ package de.tudresden.inf.st.jastadd.testDumper; ...@@ -3,6 +3,7 @@ package de.tudresden.inf.st.jastadd.testDumper;
import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpBuilder; import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpBuilder;
import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpNode; import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpNode;
import de.tudresden.inf.st.jastadd.dumpAst.ast.Dumper; import de.tudresden.inf.st.jastadd.dumpAst.ast.Dumper;
import de.tudresden.inf.st.jastadd.dumpAst.ast.TransformationException;
import org.jastadd.testDumper.ast.A; import org.jastadd.testDumper.ast.A;
import org.jastadd.testDumper.ast.Root; import org.jastadd.testDumper.ast.Root;
import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Disabled;
...@@ -18,7 +19,7 @@ import static org.assertj.core.api.Assertions.*; ...@@ -18,7 +19,7 @@ import static org.assertj.core.api.Assertions.*;
public class TestExcluded { public class TestExcluded {
@Test @Test
public void testEmptyStringsOnTokensDefault() { public void testEmptyStringsOnTokensDefault() throws TransformationException {
Root root = createRoot(null, null, createB(B1_NAME, "something"), createB(B2_NAME), createB(B3_NAME)); Root root = createRoot(null, null, createB(B1_NAME, "something"), createB(B2_NAME), createB(B3_NAME));
// normal mode, do not include empty strings // normal mode, do not include empty strings
...@@ -33,7 +34,7 @@ public class TestExcluded { ...@@ -33,7 +34,7 @@ public class TestExcluded {
} }
@Test @Test
public void testEmptyStringsOnTokensIncluded() { public void testEmptyStringsOnTokensIncluded() throws TransformationException {
Root root = createRoot(null, null, createB(B1_NAME, "something"), createB(B2_NAME), createB(B3_NAME)); Root root = createRoot(null, null, createB(B1_NAME, "something"), createB(B2_NAME), createB(B3_NAME));
// test mode, do include empty strings // test mode, do include empty strings
...@@ -66,7 +67,7 @@ public class TestExcluded { ...@@ -66,7 +67,7 @@ public class TestExcluded {
} }
@Test @Test
public void testTypesDefault() { public void testTypesDefault() throws TransformationException {
Root root = setupAllRelations(); Root root = setupAllRelations();
List<DumpNode> nodes = TestUtils.dumpModel(root); List<DumpNode> nodes = TestUtils.dumpModel(root);
...@@ -90,7 +91,7 @@ public class TestExcluded { ...@@ -90,7 +91,7 @@ public class TestExcluded {
} }
@Test @Test
public void testTypesNonMatching() { public void testTypesNonMatching() throws TransformationException {
Root root = setupAllRelations(); Root root = setupAllRelations();
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.disableTypes("NonExistingType")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.disableTypes("NonExistingType"));
...@@ -99,7 +100,7 @@ public class TestExcluded { ...@@ -99,7 +100,7 @@ public class TestExcluded {
} }
@Test @Test
public void testTypesInheritanceNotIncluded() { public void testTypesInheritanceNotIncluded() throws TransformationException {
Root root = setupAllRelations(); Root root = setupAllRelations();
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.disableTypes("Nameable")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.disableTypes("Nameable"));
...@@ -108,7 +109,7 @@ public class TestExcluded { ...@@ -108,7 +109,7 @@ public class TestExcluded {
} }
@Test @Test
public void testTypesExcludeOnlyA() { public void testTypesExcludeOnlyA() throws TransformationException {
Root root = setupAllRelations(); Root root = setupAllRelations();
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.disableTypes("A")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.disableTypes("A"));
...@@ -123,7 +124,7 @@ public class TestExcluded { ...@@ -123,7 +124,7 @@ public class TestExcluded {
} }
@Test @Test
public void testTypesExcludeMultipleArguments() { public void testTypesExcludeMultipleArguments() throws TransformationException {
Root root = setupAllRelations(); Root root = setupAllRelations();
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.disableTypes("A", "C")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.disableTypes("A", "C"));
...@@ -133,7 +134,7 @@ public class TestExcluded { ...@@ -133,7 +134,7 @@ public class TestExcluded {
} }
@Test @Test
public void testTypesExcludeMultipleCalls() { public void testTypesExcludeMultipleCalls() throws TransformationException {
Root root = setupAllRelations(); Root root = setupAllRelations();
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.disableTypes("A").disableTypes("C")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.disableTypes("A").disableTypes("C"));
...@@ -143,7 +144,7 @@ public class TestExcluded { ...@@ -143,7 +144,7 @@ public class TestExcluded {
} }
@Test @Test
public void testTypesExcludeRegex() { public void testTypesExcludeRegex() throws TransformationException {
Root root = setupAllRelations(); Root root = setupAllRelations();
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.disableTypes("Ro*t")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.disableTypes("Ro*t"));
...@@ -152,7 +153,7 @@ public class TestExcluded { ...@@ -152,7 +153,7 @@ public class TestExcluded {
} }
@Test @Test
public void testTypesInvisiblePath() { public void testTypesInvisiblePath() throws TransformationException {
final String A2_Name = "a2"; final String A2_Name = "a2";
final String A3_Name = "a3"; final String A3_Name = "a3";
final String C2_Name = "c2"; final String C2_Name = "c2";
...@@ -169,7 +170,7 @@ public class TestExcluded { ...@@ -169,7 +170,7 @@ public class TestExcluded {
} }
@Test @Test
public void testTokenDefault() { public void testTokenDefault() throws TransformationException {
A a = createA(A_NAME); A a = createA(A_NAME);
Root root = createRoot(a, createC(C_NAME, c -> { Root root = createRoot(a, createC(C_NAME, c -> {
c.setRawReference(a); c.setRawReference(a);
...@@ -189,7 +190,7 @@ public class TestExcluded { ...@@ -189,7 +190,7 @@ public class TestExcluded {
} }
@Test @Test
public void testTokenExcludeValue() { public void testTokenExcludeValue() throws TransformationException {
A a = createA(A_NAME); A a = createA(A_NAME);
Root root = createRoot(a, createC(C_NAME, c -> { Root root = createRoot(a, createC(C_NAME, c -> {
c.setRawReference(a); c.setRawReference(a);
...@@ -209,7 +210,7 @@ public class TestExcluded { ...@@ -209,7 +210,7 @@ public class TestExcluded {
} }
@Test @Test
public void testTokenExcludeValueAndReference() { public void testTokenExcludeValueAndReference() throws TransformationException {
A a = createA(A_NAME); A a = createA(A_NAME);
Root root = createRoot(a, createC(C_NAME, c -> { Root root = createRoot(a, createC(C_NAME, c -> {
c.setRawReference(a); c.setRawReference(a);
...@@ -229,7 +230,7 @@ public class TestExcluded { ...@@ -229,7 +230,7 @@ public class TestExcluded {
} }
@Test @Test
public void testTokenExcludeRelationNameLowerCase() { public void testTokenExcludeRelationNameLowerCase() throws TransformationException {
A a = createA(A_NAME); A a = createA(A_NAME);
Root root = createRoot(a, createC(C_NAME, c -> { Root root = createRoot(a, createC(C_NAME, c -> {
c.setRawReference(a); c.setRawReference(a);
...@@ -249,7 +250,7 @@ public class TestExcluded { ...@@ -249,7 +250,7 @@ public class TestExcluded {
} }
@Test @Test
public void testTokenExcludeRelationNameTitleCase() { public void testTokenExcludeRelationNameTitleCase() throws TransformationException {
A a = createA(A_NAME); A a = createA(A_NAME);
Root root = createRoot(a, createC(C_NAME, c -> { Root root = createRoot(a, createC(C_NAME, c -> {
c.setRawReference(a); c.setRawReference(a);
...@@ -270,7 +271,7 @@ public class TestExcluded { ...@@ -270,7 +271,7 @@ public class TestExcluded {
} }
@Test @Test
public void testChildrenDefault() { public void testChildrenDefault() throws TransformationException {
/* Root /* Root
|- a |- a
|- b - - -. |- b - - -.
...@@ -295,7 +296,7 @@ public class TestExcluded { ...@@ -295,7 +296,7 @@ public class TestExcluded {
} }
@Test @Test
public void testChildrenExclude() { public void testChildrenExclude() throws TransformationException {
/* Root /* Root
|- a |- a
|- b - - -. |- b - - -.
...@@ -319,7 +320,7 @@ public class TestExcluded { ...@@ -319,7 +320,7 @@ public class TestExcluded {
} }
@Test @Test
public void testRelationsDefault() { public void testRelationsDefault() throws TransformationException {
// actually the same test as #testTypesDefault, but can't hurt to test twice // actually the same test as #testTypesDefault, but can't hurt to test twice
Root root = setupAllRelations(); Root root = setupAllRelations();
...@@ -329,7 +330,7 @@ public class TestExcluded { ...@@ -329,7 +330,7 @@ public class TestExcluded {
} }
@Test @Test
public void testRelationsExclude() { public void testRelationsExclude() throws TransformationException {
Root root = setupAllRelations(); Root root = setupAllRelations();
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.excludeRelations("BiC1")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.excludeRelations("BiC1"));
...@@ -348,7 +349,7 @@ public class TestExcluded { ...@@ -348,7 +349,7 @@ public class TestExcluded {
} }
@Test @Test
public void testRelationsExcludeRegex1() { public void testRelationsExcludeRegex1() throws TransformationException {
Root root = setupAllRelations(); Root root = setupAllRelations();
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.excludeRelations("Bi.*")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.excludeRelations("Bi.*"));
...@@ -365,7 +366,7 @@ public class TestExcluded { ...@@ -365,7 +366,7 @@ public class TestExcluded {
} }
@Test @Test
public void testRelationsExcludeRegex2() { public void testRelationsExcludeRegex2() throws TransformationException {
Root root = setupAllRelations(); Root root = setupAllRelations();
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.excludeRelations(".*A.*")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.excludeRelations(".*A.*"));
......
package de.tudresden.inf.st.jastadd.testDumper; package de.tudresden.inf.st.jastadd.testDumper;
import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpNode; import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpNode;
import de.tudresden.inf.st.jastadd.dumpAst.ast.TransformationException;
import org.jastadd.testDumper.ast.Root; import org.jastadd.testDumper.ast.Root;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
...@@ -12,7 +13,7 @@ import static org.assertj.core.api.Assertions.*; ...@@ -12,7 +13,7 @@ import static org.assertj.core.api.Assertions.*;
public class TestIncluded { public class TestIncluded {
@Test @Test
public void testValueAttributeDefault() { public void testValueAttributeDefault() throws TransformationException {
Root root = createRoot(null, null); Root root = createRoot(null, null);
List<DumpNode> nodes = TestUtils.dumpModel(root); List<DumpNode> nodes = TestUtils.dumpModel(root);
...@@ -22,7 +23,7 @@ public class TestIncluded { ...@@ -22,7 +23,7 @@ public class TestIncluded {
} }
@Test @Test
public void testValueAttributeIncluded() { public void testValueAttributeIncluded() throws TransformationException {
Root root = createRoot(null, null); Root root = createRoot(null, null);
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.includeAttributes("simpleAttr")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.includeAttributes("simpleAttr"));
...@@ -32,7 +33,7 @@ public class TestIncluded { ...@@ -32,7 +33,7 @@ public class TestIncluded {
} }
@Test @Test
public void testReferenceListAttributeIncluded() { public void testReferenceListAttributeIncluded() throws TransformationException {
Root root = createRoot(null, null, createB(B1_NAME), createB(B2_NAME), createB(B3_NAME)); Root root = createRoot(null, null, createB(B1_NAME), createB(B2_NAME), createB(B3_NAME));
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.includeAttributes("setOfBs")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.includeAttributes("setOfBs"));
...@@ -44,7 +45,7 @@ public class TestIncluded { ...@@ -44,7 +45,7 @@ public class TestIncluded {
} }
@Test @Test
public void testReferenceAttributeDefault() { public void testReferenceAttributeDefault() throws TransformationException {
Root root = createRoot(createA(A_NAME), null); Root root = createRoot(createA(A_NAME), null);
List<DumpNode> nodes = TestUtils.dumpModel(root); List<DumpNode> nodes = TestUtils.dumpModel(root);
...@@ -54,7 +55,7 @@ public class TestIncluded { ...@@ -54,7 +55,7 @@ public class TestIncluded {
} }
@Test @Test
public void testReferenceAttributeIncluded() { public void testReferenceAttributeIncluded() throws TransformationException {
Root root = createRoot(createA(A_NAME), null); Root root = createRoot(createA(A_NAME), null);
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.includeAttributes("referenceAttr")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.includeAttributes("referenceAttr"));
...@@ -64,7 +65,7 @@ public class TestIncluded { ...@@ -64,7 +65,7 @@ public class TestIncluded {
} }
@Test @Test
public void testNormalNTADefault() { public void testNormalNTADefault() throws TransformationException {
Root root = createRoot(null, createC(C_NAME)); Root root = createRoot(null, createC(C_NAME));
List<DumpNode> nodes = TestUtils.dumpModel(root); List<DumpNode> nodes = TestUtils.dumpModel(root);
...@@ -74,7 +75,7 @@ public class TestIncluded { ...@@ -74,7 +75,7 @@ public class TestIncluded {
} }
@Test @Test
public void testNormalNTAIncluded() { public void testNormalNTAIncluded() throws TransformationException {
Root root = createRoot(null, createC(C_NAME)); Root root = createRoot(null, createC(C_NAME));
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.includeNonterminalAttributes("Calculated")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.includeNonterminalAttributes("Calculated"));
...@@ -84,7 +85,7 @@ public class TestIncluded { ...@@ -84,7 +85,7 @@ public class TestIncluded {
} }
@Test @Test
public void testListNTADefault() { public void testListNTADefault() throws TransformationException {
Root root = createRoot(null, createC(C_NAME)); Root root = createRoot(null, createC(C_NAME));
List<DumpNode> nodes = TestUtils.dumpModel(root); List<DumpNode> nodes = TestUtils.dumpModel(root);
...@@ -95,7 +96,7 @@ public class TestIncluded { ...@@ -95,7 +96,7 @@ public class TestIncluded {
} }
@Test @Test
public void testListNTAIncluded() { public void testListNTAIncluded() throws TransformationException {
Root root = createRoot(null, createC(C_NAME)); Root root = createRoot(null, createC(C_NAME));
List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.includeNonterminalAttributes("AlsoCalculated")); List<DumpNode> nodes = TestUtils.dumpModel(root, db -> db.includeNonterminalAttributes("AlsoCalculated"));
......
...@@ -3,6 +3,7 @@ package de.tudresden.inf.st.jastadd.testDumper; ...@@ -3,6 +3,7 @@ package de.tudresden.inf.st.jastadd.testDumper;
import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpAst; import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpAst;
import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpBuilder; import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpBuilder;
import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpNode; import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpNode;
import de.tudresden.inf.st.jastadd.dumpAst.ast.TransformationException;
import org.jastadd.testDumper.ast.*; import org.jastadd.testDumper.ast.*;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
...@@ -20,7 +21,7 @@ import static org.junit.jupiter.api.Assertions.*; ...@@ -20,7 +21,7 @@ import static org.junit.jupiter.api.Assertions.*;
public class TestSimple { public class TestSimple {
@Test @Test
public void testEmpty() { public void testEmpty() throws TransformationException {
Root root = createRoot(null, null); Root root = createRoot(null, null);
List<DumpNode> nodes = TestUtils.dumpModel(root); List<DumpNode> nodes = TestUtils.dumpModel(root);
...@@ -32,7 +33,7 @@ public class TestSimple { ...@@ -32,7 +33,7 @@ public class TestSimple {
} }
@Test @Test
public void testCustomPreamble() throws IOException { public void testCustomPreamble() throws IOException, TransformationException {
Root root = createRoot(null, null); Root root = createRoot(null, null);
String preamble = "{<\n>\n}"; String preamble = "{<\n>\n}";
ExposingDumpBuilder builder = new ExposingDumpBuilder(root); ExposingDumpBuilder builder = new ExposingDumpBuilder(root);
...@@ -47,7 +48,7 @@ public class TestSimple { ...@@ -47,7 +48,7 @@ public class TestSimple {
assertThat(puml).contains(preamble); assertThat(puml).contains(preamble);
} }
@Test void testChildlessNonterminal() { @Test void testChildlessNonterminal() throws TransformationException {
Root root = createRoot(createA(A_NAME, a -> a.setD(new D())), null); Root root = createRoot(createA(A_NAME, a -> a.setD(new D())), null);
List<DumpNode> nodes = TestUtils.dumpModel(root); List<DumpNode> nodes = TestUtils.dumpModel(root);
Optional<DumpNode> actualD = nodes.stream().filter(n -> n.getObject() instanceof D).findFirst(); Optional<DumpNode> actualD = nodes.stream().filter(n -> n.getObject() instanceof D).findFirst();
...@@ -56,7 +57,7 @@ public class TestSimple { ...@@ -56,7 +57,7 @@ public class TestSimple {
} }
@Test @Test
public void testOneNormalChild() { public void testOneNormalChild() throws TransformationException {
Root root = createRoot(createA(A_NAME), null); Root root = createRoot(createA(A_NAME), null);
List<DumpNode> nodes = TestUtils.dumpModel(root); List<DumpNode> nodes = TestUtils.dumpModel(root);
...@@ -69,7 +70,7 @@ public class TestSimple { ...@@ -69,7 +70,7 @@ public class TestSimple {
} }
@Test @Test
public void testOneNormalChildIncludeNullNodes() { public void testOneNormalChildIncludeNullNodes() throws TransformationException {
Root root = createRoot(createA(A_NAME), null); Root root = createRoot(createA(A_NAME), null);
List<DumpNode> nodes = TestUtils.dumpModel(root, DumpBuilder::includeNullNodes); List<DumpNode> nodes = TestUtils.dumpModel(root, DumpBuilder::includeNullNodes);
...@@ -95,7 +96,7 @@ public class TestSimple { ...@@ -95,7 +96,7 @@ public class TestSimple {
} }
@Test @Test
public void testListChildren() { public void testListChildren() throws TransformationException {
Root root = createRoot(null, null, createB(B1_NAME), createB(B2_NAME), createB(B3_NAME)); Root root = createRoot(null, null, createB(B1_NAME), createB(B2_NAME), createB(B3_NAME));
List<DumpNode> nodes = TestUtils.dumpModel(root); List<DumpNode> nodes = TestUtils.dumpModel(root);
...@@ -108,7 +109,7 @@ public class TestSimple { ...@@ -108,7 +109,7 @@ public class TestSimple {
} }
@Test @Test
public void testOrderedListChildren() { public void testOrderedListChildren() throws TransformationException {
Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B1_NAME), createB(B2_NAME), createB(B3_NAME)); Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B1_NAME), createB(B2_NAME), createB(B3_NAME));
List<DumpNode> nodes = TestUtils.dumpModel(root, DumpBuilder::orderChildren); List<DumpNode> nodes = TestUtils.dumpModel(root, DumpBuilder::orderChildren);
...@@ -144,7 +145,7 @@ public class TestSimple { ...@@ -144,7 +145,7 @@ public class TestSimple {
} }
@Test @Test
public void testNoOptChild() { public void testNoOptChild() throws TransformationException {
Root root = new Root().setName(ROOT_NAME); Root root = new Root().setName(ROOT_NAME);
List<DumpNode> nodes = TestUtils.dumpModel(root); List<DumpNode> nodes = TestUtils.dumpModel(root);
...@@ -157,7 +158,7 @@ public class TestSimple { ...@@ -157,7 +158,7 @@ public class TestSimple {
} }
@Test @Test
public void testOneOptChild() { public void testOneOptChild() throws TransformationException {
Root root = createRoot(null, createC(C_NAME)); Root root = createRoot(null, createC(C_NAME));
List<DumpNode> nodes = TestUtils.dumpModel(root); List<DumpNode> nodes = TestUtils.dumpModel(root);
...@@ -170,7 +171,7 @@ public class TestSimple { ...@@ -170,7 +171,7 @@ public class TestSimple {
} }
@Test @Test
public void testNormalUniRelation() { public void testNormalUniRelation() throws TransformationException {
Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B_NAME)); Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B_NAME));
root.getB(0).setOneA(root.getA()); root.getB(0).setOneA(root.getA());
...@@ -181,7 +182,7 @@ public class TestSimple { ...@@ -181,7 +182,7 @@ public class TestSimple {
} }
@Test @Test
public void testListUniRelation() { public void testListUniRelation() throws TransformationException {
final String A2_NAME = "anotherA"; final String A2_NAME = "anotherA";
Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B_NAME)); Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B_NAME));
root.getC().setA(createA(A2_NAME)); root.getC().setA(createA(A2_NAME));
...@@ -195,7 +196,7 @@ public class TestSimple { ...@@ -195,7 +196,7 @@ public class TestSimple {
} }
@Test @Test
public void testOptUniRelation() { public void testOptUniRelation() throws TransformationException {
Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B_NAME)); Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B_NAME));
root.getB(0).setMaybeC(root.getC()); root.getB(0).setMaybeC(root.getC());
...@@ -206,7 +207,7 @@ public class TestSimple { ...@@ -206,7 +207,7 @@ public class TestSimple {
} }
@Test @Test
public void testNormalBiRelation() { public void testNormalBiRelation() throws TransformationException {
Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B_NAME)); Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B_NAME));
root.getC().setBiA1(root.getA()); root.getC().setBiA1(root.getA());
...@@ -220,7 +221,7 @@ public class TestSimple { ...@@ -220,7 +221,7 @@ public class TestSimple {
} }
@Test @Test
public void testListBiRelation() { public void testListBiRelation() throws TransformationException {
Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B_NAME)); Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B_NAME));
root.getC().addBiA2(root.getA()); root.getC().addBiA2(root.getA());
...@@ -234,7 +235,7 @@ public class TestSimple { ...@@ -234,7 +235,7 @@ public class TestSimple {
} }
@Test @Test
public void testOptBiRelation() { public void testOptBiRelation() throws TransformationException {
Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B_NAME)); Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B_NAME));
root.getC().setBiA3(root.getA()); root.getC().setBiA3(root.getA());
...@@ -248,7 +249,7 @@ public class TestSimple { ...@@ -248,7 +249,7 @@ public class TestSimple {
} }
@Test @Test
public void testOneNormalReferenceToken() { public void testOneNormalReferenceToken() throws TransformationException {
Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B_NAME)); Root root = createRoot(createA(A_NAME), createC(C_NAME), createB(B_NAME));
root.getC().setRawReference(root.getA()); root.getC().setRawReference(root.getA());
...@@ -259,7 +260,7 @@ public class TestSimple { ...@@ -259,7 +260,7 @@ public class TestSimple {
} }
@Test @Test
public void testChildrenReorder1() { public void testChildrenReorder1() throws TransformationException {
C subC = new SubC(); C subC = new SubC();
subC.setName(C_NAME); subC.setName(C_NAME);
subC.setUnwanted(5); subC.setUnwanted(5);
...@@ -277,7 +278,7 @@ public class TestSimple { ...@@ -277,7 +278,7 @@ public class TestSimple {
} }
@Test @Test
public void testLabel() { public void testLabel() throws TransformationException {
Root root = createRoot(createA(A_NAME), null); Root root = createRoot(createA(A_NAME), null);
List<DumpNode> nodes = TestUtils.dumpModel(root, List<DumpNode> nodes = TestUtils.dumpModel(root,
...@@ -290,7 +291,7 @@ public class TestSimple { ...@@ -290,7 +291,7 @@ public class TestSimple {
} }
@Test @Test
public void testTextColor() { public void testTextColor() throws TransformationException {
Root root = createRoot(createA(A_NAME), null); Root root = createRoot(createA(A_NAME), null);
List<DumpNode> nodes = TestUtils.dumpModel(root, List<DumpNode> nodes = TestUtils.dumpModel(root,
...@@ -303,7 +304,7 @@ public class TestSimple { ...@@ -303,7 +304,7 @@ public class TestSimple {
} }
@Test @Test
public void testBackgroundColor() { public void testBackgroundColor() throws TransformationException {
Root root = createRoot(createA(A_NAME), null); Root root = createRoot(createA(A_NAME), null);
List<DumpNode> nodes = TestUtils.dumpModel(root, List<DumpNode> nodes = TestUtils.dumpModel(root,
......
package de.tudresden.inf.st.jastadd.testDumper; package de.tudresden.inf.st.jastadd.testDumper;
import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpNode; import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpNode;
import de.tudresden.inf.st.jastadd.dumpAst.ast.TransformationException;
import org.jastadd.testDumper.ast.A; import org.jastadd.testDumper.ast.A;
import org.jastadd.testDumper.ast.AbstractT; import org.jastadd.testDumper.ast.AbstractT;
import org.jastadd.testDumper.ast.TRoot; import org.jastadd.testDumper.ast.TRoot;
...@@ -24,7 +25,7 @@ import static org.assertj.core.api.Assertions.*; ...@@ -24,7 +25,7 @@ import static org.assertj.core.api.Assertions.*;
public class TestTypeLevel3 { public class TestTypeLevel3 {
@Test @Test
public void testTokenLevel2Excluded() { public void testTokenLevel2Excluded() throws TransformationException {
Consumer<AbstractT> setUnwanted = t -> t.setUnwanted(5); Consumer<AbstractT> setUnwanted = t -> t.setUnwanted(5);
TRoot root = createTRoot(createA(A_NAME), createT1(setUnwanted), createT2(setUnwanted), createT3(setUnwanted)); TRoot root = createTRoot(createA(A_NAME), createT1(setUnwanted), createT2(setUnwanted), createT3(setUnwanted));
Assertions.assertEquals(5, root.getT2().getUnwanted()); Assertions.assertEquals(5, root.getT2().getUnwanted());
...@@ -38,7 +39,7 @@ public class TestTypeLevel3 { ...@@ -38,7 +39,7 @@ public class TestTypeLevel3 {
} }
@Test @Test
public void testTokenLevel3SomeIncluded() { public void testTokenLevel3SomeIncluded() throws TransformationException {
Consumer<AbstractT> setUnwanted = t -> t.setUnwanted(5); Consumer<AbstractT> setUnwanted = t -> t.setUnwanted(5);
TRoot root = createTRoot(createA(A_NAME), createT1(setUnwanted), createT2(setUnwanted), createT3(setUnwanted)); TRoot root = createTRoot(createA(A_NAME), createT1(setUnwanted), createT2(setUnwanted), createT3(setUnwanted));
Assertions.assertEquals(5, root.getT2().getUnwanted()); Assertions.assertEquals(5, root.getT2().getUnwanted());
...@@ -67,7 +68,7 @@ public class TestTypeLevel3 { ...@@ -67,7 +68,7 @@ public class TestTypeLevel3 {
} }
@Test @Test
public void testNormalChildLevel2Excluded() { public void testNormalChildLevel2Excluded() throws TransformationException {
Consumer<AbstractT> setB = t -> t.setB(createB(t.getName() + B_NAME)); Consumer<AbstractT> setB = t -> t.setB(createB(t.getName() + B_NAME));
TRoot root = createTRoot(createA(A_NAME), createT1(setB), createT2(setB), createT3(setB)); TRoot root = createTRoot(createA(A_NAME), createT1(setB), createT2(setB), createT3(setB));
Assertions.assertEquals(T2_NAME + B_NAME, root.getT2().getB().getName()); Assertions.assertEquals(T2_NAME + B_NAME, root.getT2().getB().getName());
...@@ -81,7 +82,7 @@ public class TestTypeLevel3 { ...@@ -81,7 +82,7 @@ public class TestTypeLevel3 {
} }
@Test @Test
public void testNormalChildLevel3SomeIncluded() { public void testNormalChildLevel3SomeIncluded() throws TransformationException {
Consumer<AbstractT> setB = t -> t.setB(createB(t.getName() + B_NAME)); Consumer<AbstractT> setB = t -> t.setB(createB(t.getName() + B_NAME));
TRoot root = createTRoot(createA(A_NAME), createT1(setB), createT2(setB), createT3(setB)); TRoot root = createTRoot(createA(A_NAME), createT1(setB), createT2(setB), createT3(setB));
Assertions.assertEquals(T2_NAME + B_NAME, root.getT2().getB().getName()); Assertions.assertEquals(T2_NAME + B_NAME, root.getT2().getB().getName());
...@@ -97,7 +98,7 @@ public class TestTypeLevel3 { ...@@ -97,7 +98,7 @@ public class TestTypeLevel3 {
} }
@Test @Test
public void testListChildLevel2Excluded() { public void testListChildLevel2Excluded() throws TransformationException {
Consumer<AbstractT> addBee = t -> t.addBee(createB(t.getName() + B_NAME)); Consumer<AbstractT> addBee = t -> t.addBee(createB(t.getName() + B_NAME));
TRoot root = createTRoot(createA(A_NAME), createT1(addBee), createT2(addBee), createT3(addBee)); TRoot root = createTRoot(createA(A_NAME), createT1(addBee), createT2(addBee), createT3(addBee));
Assertions.assertEquals(T2_NAME + B_NAME, root.getT2().getBee(0).getName()); Assertions.assertEquals(T2_NAME + B_NAME, root.getT2().getBee(0).getName());
...@@ -111,7 +112,7 @@ public class TestTypeLevel3 { ...@@ -111,7 +112,7 @@ public class TestTypeLevel3 {
} }
@Test @Test
public void testListChildLevel3SomeIncluded() { public void testListChildLevel3SomeIncluded() throws TransformationException {
Consumer<AbstractT> addBee = t -> t.addBee(createB(t.getName() + B_NAME)); Consumer<AbstractT> addBee = t -> t.addBee(createB(t.getName() + B_NAME));
TRoot root = createTRoot(createA(A_NAME), createT1(addBee), createT2(addBee), createT3(addBee)); TRoot root = createTRoot(createA(A_NAME), createT1(addBee), createT2(addBee), createT3(addBee));
Assertions.assertEquals(T2_NAME + B_NAME, root.getT2().getBee(0).getName()); Assertions.assertEquals(T2_NAME + B_NAME, root.getT2().getBee(0).getName());
...@@ -127,7 +128,7 @@ public class TestTypeLevel3 { ...@@ -127,7 +128,7 @@ public class TestTypeLevel3 {
} }
@Test @Test
public void testRelationLevel2Excluded() { public void testRelationLevel2Excluded() throws TransformationException {
final A a = createA(A_NAME); final A a = createA(A_NAME);
Consumer<AbstractT> setOneA = t -> t.setOneA(a); Consumer<AbstractT> setOneA = t -> t.setOneA(a);
TRoot root = createTRoot(a, createT1(setOneA), createT2(setOneA), createT3(setOneA)); TRoot root = createTRoot(a, createT1(setOneA), createT2(setOneA), createT3(setOneA));
...@@ -142,7 +143,7 @@ public class TestTypeLevel3 { ...@@ -142,7 +143,7 @@ public class TestTypeLevel3 {
} }
@Test @Test
public void testRelationLevel3SomeIncluded() { public void testRelationLevel3SomeIncluded() throws TransformationException {
final A a = createA(A_NAME); final A a = createA(A_NAME);
Consumer<AbstractT> setOneA = t -> t.setOneA(a); Consumer<AbstractT> setOneA = t -> t.setOneA(a);
TRoot root = createTRoot(a, createT1(setOneA), createT2(setOneA), createT3(setOneA)); TRoot root = createTRoot(a, createT1(setOneA), createT2(setOneA), createT3(setOneA));
...@@ -159,7 +160,7 @@ public class TestTypeLevel3 { ...@@ -159,7 +160,7 @@ public class TestTypeLevel3 {
} }
@Test @Test
public void testAttributeLevel2Included() { public void testAttributeLevel2Included() throws TransformationException {
TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3()); TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3());
List<DumpNode> nodes = dumpModel(root, List<DumpNode> nodes = dumpModel(root,
...@@ -175,7 +176,7 @@ public class TestTypeLevel3 { ...@@ -175,7 +176,7 @@ public class TestTypeLevel3 {
} }
@Test @Test
public void testAttributeLevel3SomeExcluded() { public void testAttributeLevel3SomeExcluded() throws TransformationException {
TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3()); TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3());
List<DumpNode> nodes = dumpModel(root, List<DumpNode> nodes = dumpModel(root,
...@@ -191,7 +192,7 @@ public class TestTypeLevel3 { ...@@ -191,7 +192,7 @@ public class TestTypeLevel3 {
} }
@Test @Test
public void testNTALevel2Included() { public void testNTALevel2Included() throws TransformationException {
TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3()); TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3());
List<DumpNode> nodes = dumpModel(root, List<DumpNode> nodes = dumpModel(root,
...@@ -204,7 +205,7 @@ public class TestTypeLevel3 { ...@@ -204,7 +205,7 @@ public class TestTypeLevel3 {
} }
@Test @Test
public void testNTALevel3SomeExcluded() { public void testNTALevel3SomeExcluded() throws TransformationException {
TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3()); TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3());
List<DumpNode> nodes = dumpModel(root, List<DumpNode> nodes = dumpModel(root,
......
package de.tudresden.inf.st.jastadd.testDumper; package de.tudresden.inf.st.jastadd.testDumper;
import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpNode; import de.tudresden.inf.st.jastadd.dumpAst.ast.DumpNode;
import de.tudresden.inf.st.jastadd.dumpAst.ast.TransformationException;
import org.jastadd.testDumper.ast.A; import org.jastadd.testDumper.ast.A;
import org.jastadd.testDumper.ast.AbstractT; import org.jastadd.testDumper.ast.AbstractT;
import org.jastadd.testDumper.ast.TRoot; import org.jastadd.testDumper.ast.TRoot;
...@@ -23,7 +24,7 @@ import static org.assertj.core.api.Assertions.*; ...@@ -23,7 +24,7 @@ import static org.assertj.core.api.Assertions.*;
public class TestTypeLevel4 { public class TestTypeLevel4 {
@Test @Test
public void testTokenLevel3Included() { public void testTokenLevel3Included() throws TransformationException {
Consumer<AbstractT> setUnwanted = t -> t.setUnwanted(5); Consumer<AbstractT> setUnwanted = t -> t.setUnwanted(5);
TRoot root = createTRoot(createA(A_NAME, createC(C_NAME, c -> c.setUnwanted(6))), TRoot root = createTRoot(createA(A_NAME, createC(C_NAME, c -> c.setUnwanted(6))),
createT1(setUnwanted), createT2(setUnwanted), createT3(setUnwanted)); createT1(setUnwanted), createT2(setUnwanted), createT3(setUnwanted));
...@@ -43,7 +44,7 @@ public class TestTypeLevel4 { ...@@ -43,7 +44,7 @@ public class TestTypeLevel4 {
} }
@Test @Test
public void testTokenLevel4SomeExcluded() { public void testTokenLevel4SomeExcluded() throws TransformationException {
Consumer<AbstractT> setUnwanted = t -> t.setUnwanted(5); Consumer<AbstractT> setUnwanted = t -> t.setUnwanted(5);
TRoot root = createTRoot(createA(A_NAME, createC(C_NAME, c -> c.setUnwanted(6))), TRoot root = createTRoot(createA(A_NAME, createC(C_NAME, c -> c.setUnwanted(6))),
createT1(setUnwanted), createT2(setUnwanted), createT3(setUnwanted)); createT1(setUnwanted), createT2(setUnwanted), createT3(setUnwanted));
...@@ -81,7 +82,7 @@ public class TestTypeLevel4 { ...@@ -81,7 +82,7 @@ public class TestTypeLevel4 {
} }
@Test @Test
public void testNormalChildLevel3Included() { public void testNormalChildLevel3Included() throws TransformationException {
Consumer<AbstractT> setB = t -> t.setB(createB(t.getName() + B_NAME)); Consumer<AbstractT> setB = t -> t.setB(createB(t.getName() + B_NAME));
TRoot root = createTRoot(createA(A_NAME), createT1(setB), createT2(setB), createT3(setB)); TRoot root = createTRoot(createA(A_NAME), createT1(setB), createT2(setB), createT3(setB));
Assertions.assertEquals(T2_NAME + B_NAME, root.getT2().getB().getName()); Assertions.assertEquals(T2_NAME + B_NAME, root.getT2().getB().getName());
...@@ -97,7 +98,7 @@ public class TestTypeLevel4 { ...@@ -97,7 +98,7 @@ public class TestTypeLevel4 {
} }
@Test @Test
public void testNormalChildLevel4SomeExcluded() { public void testNormalChildLevel4SomeExcluded() throws TransformationException {
Consumer<AbstractT> setB = t -> t.setB(createB(t.getName() + B_NAME)); Consumer<AbstractT> setB = t -> t.setB(createB(t.getName() + B_NAME));
TRoot root = createTRoot(createA(A_NAME), createT1(setB), createT2(setB), createT3(setB)); TRoot root = createTRoot(createA(A_NAME), createT1(setB), createT2(setB), createT3(setB));
Assertions.assertEquals(T2_NAME + B_NAME, root.getT2().getB().getName()); Assertions.assertEquals(T2_NAME + B_NAME, root.getT2().getB().getName());
...@@ -115,7 +116,7 @@ public class TestTypeLevel4 { ...@@ -115,7 +116,7 @@ public class TestTypeLevel4 {
} }
@Test @Test
public void testListChildLevel3Included() { public void testListChildLevel3Included() throws TransformationException {
Consumer<AbstractT> addBee = t -> t.addBee(createB(t.getName() + B_NAME)); Consumer<AbstractT> addBee = t -> t.addBee(createB(t.getName() + B_NAME));
TRoot root = createTRoot(createA(A_NAME), createT1(addBee), createT2(addBee), createT3(addBee)); TRoot root = createTRoot(createA(A_NAME), createT1(addBee), createT2(addBee), createT3(addBee));
Assertions.assertEquals(T3_NAME + B_NAME, root.getT3().getBee(0).getName()); Assertions.assertEquals(T3_NAME + B_NAME, root.getT3().getBee(0).getName());
...@@ -131,7 +132,7 @@ public class TestTypeLevel4 { ...@@ -131,7 +132,7 @@ public class TestTypeLevel4 {
} }
@Test @Test
public void testListChildLevel4SomeExcluded() { public void testListChildLevel4SomeExcluded() throws TransformationException {
Consumer<AbstractT> addBee = t -> t.addBee(createB(t.getName() + B_NAME)); Consumer<AbstractT> addBee = t -> t.addBee(createB(t.getName() + B_NAME));
TRoot root = createTRoot(createA(A_NAME), createT1(addBee), createT2(addBee), createT3(addBee)); TRoot root = createTRoot(createA(A_NAME), createT1(addBee), createT2(addBee), createT3(addBee));
Assertions.assertEquals(T3_NAME + B_NAME, root.getT3().getBee(0).getName()); Assertions.assertEquals(T3_NAME + B_NAME, root.getT3().getBee(0).getName());
...@@ -149,7 +150,7 @@ public class TestTypeLevel4 { ...@@ -149,7 +150,7 @@ public class TestTypeLevel4 {
} }
@Test @Test
public void testRelationLevel3Included() { public void testRelationLevel3Included() throws TransformationException {
final A a = createA(A_NAME); final A a = createA(A_NAME);
Consumer<AbstractT> setOneA = t -> t.setOneA(a); Consumer<AbstractT> setOneA = t -> t.setOneA(a);
TRoot root = createTRoot(a, createT1(setOneA), createT2(setOneA), createT3(setOneA)); TRoot root = createTRoot(a, createT1(setOneA), createT2(setOneA), createT3(setOneA));
...@@ -166,7 +167,7 @@ public class TestTypeLevel4 { ...@@ -166,7 +167,7 @@ public class TestTypeLevel4 {
} }
@Test @Test
public void testRelationLevel4SomeExcluded() { public void testRelationLevel4SomeExcluded() throws TransformationException {
final A a = createA(A_NAME); final A a = createA(A_NAME);
Consumer<AbstractT> setOneA = t -> t.setOneA(a); Consumer<AbstractT> setOneA = t -> t.setOneA(a);
TRoot root = createTRoot(a, createT1(setOneA), createT2(setOneA), createT3(setOneA)); TRoot root = createTRoot(a, createT1(setOneA), createT2(setOneA), createT3(setOneA));
...@@ -185,7 +186,7 @@ public class TestTypeLevel4 { ...@@ -185,7 +186,7 @@ public class TestTypeLevel4 {
} }
@Test @Test
public void testAttributeLevel3Excluded() { public void testAttributeLevel3Excluded() throws TransformationException {
TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3()); TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3());
List<DumpNode> nodes = TestUtils.dumpModel(root, List<DumpNode> nodes = TestUtils.dumpModel(root,
...@@ -200,7 +201,7 @@ public class TestTypeLevel4 { ...@@ -200,7 +201,7 @@ public class TestTypeLevel4 {
} }
@Test @Test
public void testAttributeLevel4SomeIncluded() { public void testAttributeLevel4SomeIncluded() throws TransformationException {
TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3()); TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3());
List<DumpNode> nodes = TestUtils.dumpModel(root, List<DumpNode> nodes = TestUtils.dumpModel(root,
...@@ -217,7 +218,7 @@ public class TestTypeLevel4 { ...@@ -217,7 +218,7 @@ public class TestTypeLevel4 {
} }
@Test @Test
public void testNTALevel3Excluded() { public void testNTALevel3Excluded() throws TransformationException {
TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3()); TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3());
List<DumpNode> nodes = TestUtils.dumpModel(root, List<DumpNode> nodes = TestUtils.dumpModel(root,
...@@ -229,7 +230,7 @@ public class TestTypeLevel4 { ...@@ -229,7 +230,7 @@ public class TestTypeLevel4 {
} }
@Test @Test
public void testNTALevel4SomeIncluded() { public void testNTALevel4SomeIncluded() throws TransformationException {
TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3()); TRoot root = createTRoot(createA(A_NAME), createT1(), createT2(), createT3());
List<DumpNode> nodes = TestUtils.dumpModel(root, List<DumpNode> nodes = TestUtils.dumpModel(root,
......
...@@ -150,11 +150,11 @@ public class TestUtils { ...@@ -150,11 +150,11 @@ public class TestUtils {
return Assertions.assertThat(map.get(key)).flatExtracting(NAME_EXTRACTOR); return Assertions.assertThat(map.get(key)).flatExtracting(NAME_EXTRACTOR);
} }
public static List<DumpNode> dumpModel(Object target) { public static List<DumpNode> dumpModel(Object target) throws TransformationException {
return dumpModel(target, db -> {}); return dumpModel(target, db -> {});
} }
public static List<DumpNode> dumpModel(Object target, Consumer<DumpBuilder> options) { public static List<DumpNode> dumpModel(Object target, Consumer<DumpBuilder> options) throws TransformationException {
ExposingDumpBuilder builder = new ExposingDumpBuilder(target); ExposingDumpBuilder builder = new ExposingDumpBuilder(target);
builder.excludeNullNodes(); builder.excludeNullNodes();
options.accept(builder); options.accept(builder);
...@@ -297,7 +297,7 @@ public class TestUtils { ...@@ -297,7 +297,7 @@ public class TestUtils {
} }
@Override @Override
public DumpAst build() { public DumpAst build() throws TransformationException {
return super.build(); return super.build();
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment