diff options
Diffstat (limited to 'examples/10-transient-0/output/java-junit')
3 files changed, 91 insertions, 0 deletions
diff --git a/examples/10-transient-0/output/java-junit/.gitignore b/examples/10-transient-0/output/java-junit/.gitignore new file mode 100644 index 0000000..ff511d4 --- /dev/null +++ b/examples/10-transient-0/output/java-junit/.gitignore @@ -0,0 +1,2 @@ +/src/gen/ +/target/ diff --git a/examples/10-transient-0/output/java-junit/pom.xml b/examples/10-transient-0/output/java-junit/pom.xml new file mode 100644 index 0000000..88ef3e5 --- /dev/null +++ b/examples/10-transient-0/output/java-junit/pom.xml @@ -0,0 +1,64 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>org.zwobble.hobgoblin.examples</groupId> + <artifactId>example</artifactId> + <version>1.0-SNAPSHOT</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <maven.compiler.source>25</maven.compiler.source> + <maven.compiler.target>25</maven.compiler.target> + </properties> + + <dependencyManagement> + <dependencies> + <dependency> + <groupId>org.junit</groupId> + <artifactId>junit-bom</artifactId> + <version>5.9.3</version> + <type>pom</type> + <scope>import</scope> + </dependency> + </dependencies> + </dependencyManagement> + + <dependencies> + <dependency> + <groupId>org.zwobble.precisely</groupId> + <artifactId>precisely</artifactId> + <version>0.1.5</version> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>build-helper-maven-plugin</artifactId> + <version>3.6.1</version> + <executions> + <execution> + <id>add-source</id> + <phase>generate-sources</phase> + <goals> + <goal>add-source</goal> + </goals> + <configuration> + <sources> + <source>src/gen/java</source> + </sources> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/examples/10-transient-0/output/java-junit/src/test/java/org/zwobble/example/Transient0Tests.java b/examples/10-transient-0/output/java-junit/src/test/java/org/zwobble/example/Transient0Tests.java new file mode 100644 index 0000000..4959a5c --- /dev/null +++ b/examples/10-transient-0/output/java-junit/src/test/java/org/zwobble/example/Transient0Tests.java @@ -0,0 +1,25 @@ +package org.zwobble.example; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.zwobble.example.types.point.Point; +import org.zwobble.example.types.point.HobgoblinTransient0Point; + +public class Transient0Tests { + @Test + public void structWithInt32() throws IOException { + var point = new Point(10, 25); + + var outputStream = new ByteArrayOutputStream(); + HobgoblinTransient0Point.encode(point, outputStream); + var bytes = outputStream.toByteArray(); + + var inputStream = new ByteArrayInputStream(bytes); + var decodedPoint = HobgoblinTransient0Point.decode(inputStream); + + Assertions.assertEquals(point, decodedPoint); + } +} |
