diff --git a/modello-maven-plugin/src/it/clone-java5/pom.xml b/modello-maven-plugin/src/it/clone-java5/pom.xml deleted file mode 100644 index 4ccce5b57..000000000 --- a/modello-maven-plugin/src/it/clone-java5/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - 4.0.0 - - org.codehaus.modello.its - clone - 0.1-SNAPSHOT - - Clone IT - - Test the generation of clone() methods. - - - - - org.codehaus.plexus - plexus-utils - @plexusUtilsVersion@ - - - org.junit.jupiter - junit-jupiter-api - @junit5Version@ - test - - - - - test - - - org.apache.maven.plugins - maven-compiler-plugin - 3.14.1 - - @javaVersion@ - @javaVersion@ - - - - org.apache.maven.plugins - maven-resources-plugin - 3.5.0 - - - org.apache.maven.plugins - maven-surefire-plugin - 3.5.6 - - - org.codehaus.modello - modello-maven-plugin - @project.version@ - - 1.0.0 - 5 - - src/main/mdo/thing.mdo - - - - - standard - - java - - - - - - - diff --git a/modello-maven-plugin/src/it/clone-java5/src/main/mdo/thing.mdo b/modello-maven-plugin/src/it/clone-java5/src/main/mdo/thing.mdo deleted file mode 100644 index aa8a806d2..000000000 --- a/modello-maven-plugin/src/it/clone-java5/src/main/mdo/thing.mdo +++ /dev/null @@ -1,203 +0,0 @@ - - - - thing - Thing - - - package - test - - - - - - SuperThing - 1.0.0 - - - Thing - SuperThing - 1.0.0 - - - - someBoolean - 1.0.0 - boolean - - - someChar - 1.0.0 - char - - - someByte - 1.0.0 - byte - - - someShort - 1.0.0 - short - - - someInt - 1.0.0 - int - - - someLong - 1.0.0 - long - - - someFloat - 1.0.0 - float - - - someDouble - 1.0.0 - double - - - someString - 1.0.0 - String - - - someDate - 1.0.0 - Date - - - someDom - 1.0.0 - DOM - - - - someProperties - 1.0.0 - Properties - - String - * - - - - someStringList - 1.0.0 - List - - String - * - - - - someStringSet - 1.0.0 - Set - - String - * - - - - - deepThingy - 1.0.0 - - Thingy - 1 - - - - deepThingyList - 1.0.0 - List - - Thingy - * - - - - deepThingySet - 1.0.0 - Set - - Thingy - * - - - - - shallowThingy - 1.0.0 - - Thingy - 1 - - - - shallowThingyList - 1.0.0 - List - - Thingy - * - - - - shallowThingySet - 1.0.0 - Set - - Thingy - * - - - - - - 1.0.0 - - - - - - - Thingy - SuperThing - 1.0.0 - - - diff --git a/modello-maven-plugin/src/it/clone-java5/src/test/java/test/CloneTest.java b/modello-maven-plugin/src/it/clone-java5/src/test/java/test/CloneTest.java deleted file mode 100644 index 5f48730b8..000000000 --- a/modello-maven-plugin/src/it/clone-java5/src/test/java/test/CloneTest.java +++ /dev/null @@ -1,96 +0,0 @@ -package test; - -import java.util.Date; - -import org.codehaus.plexus.util.xml.Xpp3Dom; - -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNotSame; -import static org.junit.jupiter.api.Assertions.assertSame; - -public class CloneTest -{ - @Test - public void testNullSafe() - throws Exception - { - Thing orig = new Thing(); - - Thing copy = (Thing) orig.clone(); - - assertNotNull( copy ); - assertNotSame( orig, copy ); - } - @Test - public void testClone() - throws Exception - { - Thing orig = new Thing(); - orig.setSomeBoolean( true ); - orig.setSomeChar( 'X' ); - orig.setSomeByte( (byte) 7 ); - orig.setSomeShort( (short) 11 ); - orig.setSomeInt( 13 ); - orig.setSomeLong( 17 ); - orig.setSomeFloat( -2.5f ); - orig.setSomeDouble( 3.14 ); - orig.setSomeString( "test" ); - orig.setSomeDate( new Date() ); - orig.setSomeDom( new Xpp3Dom( "test" ) ); - orig.addSomeStringList( "string" ); - orig.addSomeStringSet( "string" ); - orig.setDeepThingy( new Thingy() ); - orig.addDeepThingyList( new Thingy() ); - orig.addDeepThingySet( new Thingy() ); - orig.setShallowThingy( new Thingy() ); - orig.addShallowThingyList( new Thingy() ); - orig.addShallowThingySet( new Thingy() ); - orig.addSomeProperty( "key", "value" ); - orig.customProperties.setProperty( "key", "value" ); - - // NOTE: This has no cast and checks for covariant return value - Thing copy = orig.clone(); - - assertNotNull( copy ); - assertNotSame( orig, copy ); - - assertEquals( orig.isSomeBoolean(), copy.isSomeBoolean() ); - assertEquals( orig.getSomeChar(), copy.getSomeChar() ); - assertEquals( orig.getSomeByte(), copy.getSomeByte() ); - assertEquals( orig.getSomeShort(), copy.getSomeShort() ); - assertEquals( orig.getSomeInt(), copy.getSomeInt() ); - assertEquals( orig.getSomeLong(), copy.getSomeLong() ); - assertEquals( orig.getSomeFloat(), copy.getSomeFloat(), 0.1 ); - assertEquals( orig.getSomeDouble(), copy.getSomeDouble(), 0.1 ); - assertEquals( orig.getSomeString(), copy.getSomeString() ); - - assertEquals( orig.getSomeDate(), copy.getSomeDate() ); - assertNotSame( orig.getSomeDate(), copy.getSomeDate() ); - assertEquals( orig.getSomeDom(), copy.getSomeDom() ); - assertNotSame( orig.getSomeDom(), copy.getSomeDom() ); - - assertEquals( orig.getSomeStringList(), copy.getSomeStringList() ); - assertNotSame( orig.getSomeStringList(), copy.getSomeStringList() ); - assertEquals( orig.getSomeStringSet(), copy.getSomeStringSet() ); - assertNotSame( orig.getSomeStringSet(), copy.getSomeStringSet() ); - - assertNotSame( orig.getDeepThingy(), copy.getDeepThingy() ); - assertNotSame( orig.getDeepThingyList(), copy.getDeepThingyList() ); - assertNotSame( orig.getDeepThingyList().iterator().next(), copy.getDeepThingyList().iterator().next() ); - assertNotSame( orig.getDeepThingySet(), copy.getDeepThingySet() ); - assertNotSame( orig.getDeepThingySet().iterator().next(), copy.getDeepThingySet().iterator().next() ); - - assertSame( orig.getShallowThingy(), copy.getShallowThingy() ); - assertNotSame( orig.getShallowThingyList(), copy.getShallowThingyList() ); - assertSame( orig.getShallowThingyList().iterator().next(), copy.getShallowThingyList().iterator().next() ); - assertNotSame( orig.getShallowThingySet(), copy.getShallowThingySet() ); - assertSame( orig.getShallowThingySet().iterator().next(), copy.getShallowThingySet().iterator().next() ); - - assertEquals( orig.customProperties, copy.customProperties ); - assertNotSame( orig.customProperties, copy.customProperties ); - } - -} diff --git a/modello-maven-plugin/src/it/clone/pom.xml b/modello-maven-plugin/src/it/clone/pom.xml deleted file mode 100644 index a5df98ab5..000000000 --- a/modello-maven-plugin/src/it/clone/pom.xml +++ /dev/null @@ -1,75 +0,0 @@ - - - - 4.0.0 - - org.codehaus.modello.its - clone - 0.1-SNAPSHOT - - Clone IT - - Test the generation of clone() methods. - - - - - org.codehaus.plexus - plexus-utils - @plexusUtilsVersion@ - - - org.junit.jupiter - junit-jupiter-api - @junit5Version@ - test - - - - - test - - - org.apache.maven.plugins - maven-compiler-plugin - 3.14.1 - - @javaVersion@ - @javaVersion@ - - - - org.apache.maven.plugins - maven-resources-plugin - 3.5.0 - - - org.apache.maven.plugins - maven-surefire-plugin - 3.5.6 - - - org.codehaus.modello - modello-maven-plugin - @project.version@ - - 1.0.0 - - src/main/mdo/thing.mdo - - - ownSingularStringSet - - - - - standard - - java - - - - - - - diff --git a/modello-maven-plugin/src/it/clone/src/main/mdo/thing.mdo b/modello-maven-plugin/src/it/clone/src/main/mdo/thing.mdo deleted file mode 100644 index 9a5de71ca..000000000 --- a/modello-maven-plugin/src/it/clone/src/main/mdo/thing.mdo +++ /dev/null @@ -1,203 +0,0 @@ - - - - thing - Thing - - - package - test - - - - - - SuperThing - 1.0.0 - - - Thing - SuperThing - 1.0.0 - - - - someBoolean - 1.0.0 - boolean - - - someChar - 1.0.0 - char - - - someByte - 1.0.0 - byte - - - someShort - 1.0.0 - short - - - someInt - 1.0.0 - int - - - someLong - 1.0.0 - long - - - someFloat - 1.0.0 - float - - - someDouble - 1.0.0 - double - - - someString - 1.0.0 - String - - - someDate - 1.0.0 - Date - - - someDom - 1.0.0 - DOM - - - - someProperties - 1.0.0 - Properties - - String - * - - - - someStringLists - 1.0.0 - List - - String - * - - - - someStringSets - 1.0.0 - Set - - String - * - - - - - deepThingy - 1.0.0 - - Thingy - 1 - - - - deepThingyList - 1.0.0 - List - - Thingy - * - - - - deepThingySet - 1.0.0 - Set - - Thingy - * - - - - - shallowThingy - 1.0.0 - - Thingy - 1 - - - - shallowThingyList - 1.0.0 - List - - Thingy - * - - - - shallowThingySet - 1.0.0 - Set - - Thingy - * - - - - - - 1.0.0 - - - - - - - Thingy - SuperThing - 1.0.0 - - - diff --git a/modello-maven-plugin/src/it/clone/src/test/java/test/CloneTest.java b/modello-maven-plugin/src/it/clone/src/test/java/test/CloneTest.java deleted file mode 100644 index 9cbc92859..000000000 --- a/modello-maven-plugin/src/it/clone/src/test/java/test/CloneTest.java +++ /dev/null @@ -1,95 +0,0 @@ -package test; - -import java.util.Date; - -import org.codehaus.plexus.util.xml.Xpp3Dom; - -import org.junit.jupiter.api.Test; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNotSame; -import static org.junit.jupiter.api.Assertions.assertSame; - -public class CloneTest -{ - @Test - public void testNullSafe() - throws Exception - { - Thing orig = new Thing(); - - Thing copy = (Thing) orig.clone(); - - assertNotNull( copy ); - assertNotSame( orig, copy ); - } - @Test - public void testClone() - throws Exception - { - Thing orig = new Thing(); - orig.setSomeBoolean( true ); - orig.setSomeChar( 'X' ); - orig.setSomeByte( (byte) 7 ); - orig.setSomeShort( (short) 11 ); - orig.setSomeInt( 13 ); - orig.setSomeLong( 17 ); - orig.setSomeFloat( -2.5f ); - orig.setSomeDouble( 3.14 ); - orig.setSomeString( "test" ); - orig.setSomeDate( new Date() ); - orig.setSomeDom( new Xpp3Dom( "test" ) ); - orig.addSomeStringList( "string" ); - orig.addOwnSingularStringSet( "string" ); - orig.setDeepThingy( new Thingy() ); - orig.addDeepThingyList( new Thingy() ); - orig.addDeepThingySet( new Thingy() ); - orig.setShallowThingy( new Thingy() ); - orig.addShallowThingyList( new Thingy() ); - orig.addShallowThingySet( new Thingy() ); - orig.addSomeProperty( "key", "value" ); - orig.customProperties.setProperty( "key", "value" ); - - Thing copy = (Thing) orig.clone(); - - assertNotNull( copy ); - assertNotSame( orig, copy ); - - assertEquals( orig.isSomeBoolean(), copy.isSomeBoolean() ); - assertEquals( orig.getSomeChar(), copy.getSomeChar() ); - assertEquals( orig.getSomeByte(), copy.getSomeByte() ); - assertEquals( orig.getSomeShort(), copy.getSomeShort() ); - assertEquals( orig.getSomeInt(), copy.getSomeInt() ); - assertEquals( orig.getSomeLong(), copy.getSomeLong() ); - assertEquals( orig.getSomeFloat(), copy.getSomeFloat(), 0.1 ); - assertEquals( orig.getSomeDouble(), copy.getSomeDouble(), 0.1 ); - assertEquals( orig.getSomeString(), copy.getSomeString() ); - - assertEquals( orig.getSomeDate(), copy.getSomeDate() ); - assertNotSame( orig.getSomeDate(), copy.getSomeDate() ); - assertEquals( orig.getSomeDom(), copy.getSomeDom() ); - assertNotSame( orig.getSomeDom(), copy.getSomeDom() ); - - assertEquals( orig.getSomeStringLists(), copy.getSomeStringLists() ); - assertNotSame( orig.getSomeStringLists(), copy.getSomeStringLists() ); - assertEquals( orig.getSomeStringSets(), copy.getSomeStringSets() ); - assertNotSame( orig.getSomeStringSets(), copy.getSomeStringSets() ); - - assertNotSame( orig.getDeepThingy(), copy.getDeepThingy() ); - assertNotSame( orig.getDeepThingyList(), copy.getDeepThingyList() ); - assertNotSame( orig.getDeepThingyList().iterator().next(), copy.getDeepThingyList().iterator().next() ); - assertNotSame( orig.getDeepThingySet(), copy.getDeepThingySet() ); - assertNotSame( orig.getDeepThingySet().iterator().next(), copy.getDeepThingySet().iterator().next() ); - - assertSame( orig.getShallowThingy(), copy.getShallowThingy() ); - assertNotSame( orig.getShallowThingyList(), copy.getShallowThingyList() ); - assertSame( orig.getShallowThingyList().iterator().next(), copy.getShallowThingyList().iterator().next() ); - assertNotSame( orig.getShallowThingySet(), copy.getShallowThingySet() ); - assertSame( orig.getShallowThingySet().iterator().next(), copy.getShallowThingySet().iterator().next() ); - - assertEquals( orig.customProperties, copy.customProperties ); - assertNotSame( orig.customProperties, copy.customProperties ); - } - -} diff --git a/modello-maven-plugin/src/it/snakeyaml/pom.xml b/modello-maven-plugin/src/it/snakeyaml/pom.xml deleted file mode 100644 index e617b0048..000000000 --- a/modello-maven-plugin/src/it/snakeyaml/pom.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - 4.0.0 - - org.codehaus.modello.its - snakeyaml - 0.1-SNAPSHOT - - - - org.codehaus.modello - modello-plugin-snakeyaml - @project.version@ - - - - - - test - - - org.apache.maven.plugins - maven-compiler-plugin - 3.14.1 - - @javaVersion@ - @javaVersion@ - - - - org.apache.maven.plugins - maven-surefire-plugin - 3.0.0-M7 - - - org.codehaus.modello - modello-maven-plugin - @project.version@ - - 1.0.0 - 5 - - src/main/mdo/model.mdo - - - - - standard - - java - snakeyaml-writer - - - - - - - diff --git a/modello-maven-plugin/src/it/snakeyaml/src/main/mdo/model.mdo b/modello-maven-plugin/src/it/snakeyaml/src/main/mdo/model.mdo deleted file mode 100644 index 4b01e9643..000000000 --- a/modello-maven-plugin/src/it/snakeyaml/src/main/mdo/model.mdo +++ /dev/null @@ -1,37 +0,0 @@ - - - - model - Model - - - package - org.plexus.modello.demo.model - - - - - - Root - 1.0.0+ - - - simpleField - String - 1.0.0+ - - - - - diff --git a/modello-maven-plugin/src/it/snakeyaml/src/test/java/org/plexus/modello/demo/model/RootTest.java b/modello-maven-plugin/src/it/snakeyaml/src/test/java/org/plexus/modello/demo/model/RootTest.java deleted file mode 100644 index 9320a7d2d..000000000 --- a/modello-maven-plugin/src/it/snakeyaml/src/test/java/org/plexus/modello/demo/model/RootTest.java +++ /dev/null @@ -1,35 +0,0 @@ -package org.plexus.modello.demo.model; - -import org.plexus.modello.demo.model.io.snakeyaml.*; - -import java.io.*; - -public class RootTest { - private static Root createRoot(String fieldValue) { - Root r = new Root(); - r.setSimpleField(fieldValue); - return r; - } - - private static String asYamlString(Root root) throws IOException { - ModelSnakeYamlWriter writer = new ModelSnakeYamlWriter(); - - try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); - OutputStreamWriter osw = new OutputStreamWriter(baos)) { - writer.write(osw, root); - return baos.toString(); - } - } - - public void testWritingYaml() throws IOException { - Root root = createRoot("modello IT"); - - String rootAsYaml = asYamlString(root); - - String expected = "%YAML 1.1" + "\n" // directive used to identify the version of YAML - + "---" + "\n" // document separator - + "\"simpleField\": \"modello IT\"" + "\n"; // actual Root - assert expected.equals(rootAsYaml): "Actual: [" + rootAsYaml + "]"; - } -} - diff --git a/modello-maven-plugin/src/test/java/org/codehaus/modello/maven/ModelloJavaMojoTest.java b/modello-maven-plugin/src/test/java/org/codehaus/modello/maven/ModelloJavaMojoTest.java index 7567636b1..c7a32f800 100644 --- a/modello-maven-plugin/src/test/java/org/codehaus/modello/maven/ModelloJavaMojoTest.java +++ b/modello-maven-plugin/src/test/java/org/codehaus/modello/maven/ModelloJavaMojoTest.java @@ -25,7 +25,12 @@ import javax.inject.Inject; import java.io.File; +import java.lang.reflect.Field; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.util.Arrays; +import java.util.Collections; +import java.util.Map; import org.apache.maven.project.MavenProject; import org.codehaus.modello.core.ModelloCore; @@ -107,6 +112,46 @@ public void testModelloJavaMojo() throws Exception { javaFile.exists(), "The generated java file shouldn't exist: '" + javaFile.getAbsolutePath() + "'."); } + private String generateThing(Map pluralExceptions) throws Exception { + File outputDirectory = getTestFile("target/plural-exceptions-test-" + (pluralExceptions == null)); + + FileUtils.deleteDirectory(outputDirectory); + + ModelloJavaMojo mojo = new ModelloJavaMojo(modelloCore); + mojo.setOutputDirectory(outputDirectory); + mojo.setModels(new String[] {getTestPath("src/test/resources/plural-exceptions-model.mdo")}); + mojo.setVersion("1.0.0"); + mojo.setProject(new MavenProject()); + if (pluralExceptions != null) { + Field field = AbstractModelloGeneratorMojo.class.getDeclaredField("pluralExceptions"); + field.setAccessible(true); + field.set(mojo, pluralExceptions); + } + + mojo.execute(); + + return new String( + Files.readAllBytes( + new File(outputDirectory, "org/codehaus/mojo/modello/pluraltest/Thing.java").toPath()), + StandardCharsets.UTF_8); + } + + @Test + public void testPluralExceptionsRenameTheSingularMethods() throws Exception { + String thing = generateThing(Collections.singletonMap("someStringSets", "ownSingularStringSet")); + + assertTrue(thing.contains("void addOwnSingularStringSet("), thing); + assertFalse(thing.contains("addSomeStringSet("), thing); + } + + @Test + public void testSingularMethodsFollowTheFieldNameWithoutPluralExceptions() throws Exception { + String thing = generateThing(null); + + assertTrue(thing.contains("void addSomeStringSet("), thing); + assertFalse(thing.contains("addOwnSingularStringSet("), thing); + } + @Override public void customizeConfiguration(ContainerConfiguration containerConfiguration) { containerConfiguration.setClassPathScanning("cache"); diff --git a/modello-maven-plugin/src/test/resources/plural-exceptions-model.mdo b/modello-maven-plugin/src/test/resources/plural-exceptions-model.mdo new file mode 100644 index 000000000..40af8476b --- /dev/null +++ b/modello-maven-plugin/src/test/resources/plural-exceptions-model.mdo @@ -0,0 +1,30 @@ + + + + maven-plural-exceptions-test-model + Modello Plural Exceptions Test Model + + + package + org.codehaus.mojo.modello.pluraltest + + + + + Thing + 1.0.0 + + + someStringSets + 1.0.0 + Set + + String + * + + + + + + diff --git a/modello-plugins/modello-plugin-java/src/test/verifiers/features/FeaturesJavaVerifier.java b/modello-plugins/modello-plugin-java/src/test/verifiers/features/FeaturesJavaVerifier.java index 9564020b3..7360a4039 100644 --- a/modello-plugins/modello-plugin-java/src/test/verifiers/features/FeaturesJavaVerifier.java +++ b/modello-plugins/modello-plugin-java/src/test/verifiers/features/FeaturesJavaVerifier.java @@ -430,7 +430,8 @@ private void checkCloneNullSafe() { Thing orig = new Thing(); - Thing copy = (Thing) orig.clone(); + // no cast: clone() must have the covariant return type + Thing copy = orig.clone(); assertNotNull( copy ); assertNotSame( orig, copy ); @@ -461,7 +462,7 @@ private void checkClone() orig.addSomeProperty( "key", "value" ); orig.customProperties.setProperty( "key", "value" ); - Thing copy = (Thing) orig.clone(); + Thing copy = orig.clone(); assertNotNull( copy ); assertNotSame( orig, copy ); @@ -504,7 +505,7 @@ private void checkClone() Thingy orig2 = new Thingy(); orig2.setSomeContent( "content" ); - Thingy copy2 = (Thingy) orig2.clone(); + Thingy copy2 = orig2.clone(); assertNotNull( copy2 ); assertNotSame( orig2, copy2 ); diff --git a/modello-plugins/modello-plugin-snakeyaml/src/test/java/org/codehaus/modello/plugin/snakeyaml/SnakeYamlGeneratorTest.java b/modello-plugins/modello-plugin-snakeyaml/src/test/java/org/codehaus/modello/plugin/snakeyaml/SnakeYamlGeneratorTest.java index 31fd26a3c..fe2495500 100644 --- a/modello-plugins/modello-plugin-snakeyaml/src/test/java/org/codehaus/modello/plugin/snakeyaml/SnakeYamlGeneratorTest.java +++ b/modello-plugins/modello-plugin-snakeyaml/src/test/java/org/codehaus/modello/plugin/snakeyaml/SnakeYamlGeneratorTest.java @@ -53,5 +53,7 @@ public void testYamlGenerator() throws Throwable { modello.generate(model, "snakeyaml-reader", parameters); compileGeneratedSources(); + + verifyCompiledGeneratedSources("org.codehaus.modello.generator.snakeyaml.SnakeYamlVerifier"); } } diff --git a/modello-plugins/modello-plugin-snakeyaml/src/test/verifiers/snakeyaml/SnakeYamlVerifier.java b/modello-plugins/modello-plugin-snakeyaml/src/test/verifiers/snakeyaml/SnakeYamlVerifier.java new file mode 100644 index 000000000..60a00f727 --- /dev/null +++ b/modello-plugins/modello-plugin-snakeyaml/src/test/verifiers/snakeyaml/SnakeYamlVerifier.java @@ -0,0 +1,35 @@ +package org.codehaus.modello.generator.snakeyaml; + +import java.io.StringReader; +import java.io.StringWriter; + +import org.codehaus.modello.test.model.Model; +import org.codehaus.modello.test.model.io.snakeyaml.MavenSnakeYamlReader; +import org.codehaus.modello.test.model.io.snakeyaml.MavenSnakeYamlWriter; +import org.codehaus.modello.verifier.Verifier; + +import org.junit.jupiter.api.Assertions; + +public class SnakeYamlVerifier + extends Verifier +{ + public void verify() + throws Exception + { + Model model = new Model(); + model.setName( "modello IT" ); + + StringWriter yaml = new StringWriter(); + new MavenSnakeYamlWriter().write( yaml, model ); + + // the dumper uses the line break of the platform + String actual = yaml.toString().replace( "\r\n", "\n" ); + + // YAML directive with the version, document separator, then the model + String expected = "%YAML 1.1\n---\n\"name\": \"modello IT\"\n"; + Assertions.assertEquals( expected, actual ); + + Model read = new MavenSnakeYamlReader().read( new StringReader( yaml.toString() ) ); + Assertions.assertEquals( "modello IT", read.getName() ); + } +}