diff --git a/main/tests/data/example_project_metadata.json b/main/tests/data/example_project_metadata.json new file mode 100644 index 000000000..016955776 --- /dev/null +++ b/main/tests/data/example_project_metadata.json @@ -0,0 +1 @@ +{"_customMetadata":{},"created":"2018-10-12T10:24:28Z","tags":[],"importOptionMetadata":[{"guessCellValueTypes":false,"projectTags":[""],"ignoreLines":-1,"processQuotes":true,"fileSource":"query.tsv","encoding":"","separator":"\\t","storeBlankCellsAsNulls":true,"storeBlankRows":true,"skipDataLines":0,"includeFileSources":false,"headerLines":1,"limit":-1,"quoteCharacter":"\"","projectName":"CPVs"}],"creator":"","contributors":"","subject":"","rowCount":289,"preferenceStore":{"entries":{"scripting.starred-expressions":{"top":2147483647,"list":[],"class":"com.google.refine.preference.TopList"},"scripting.expressions":{"top":100,"list":[],"class":"com.google.refine.preference.TopList"}}},"modified":"2018-10-12T10:51:41Z","description":"","name":"CPVs","dirty":false,"title":"","homepage":"","image":"","license":"","version":""} diff --git a/main/tests/server/src/com/google/refine/tests/io/ProjectMetadataTests.java b/main/tests/server/src/com/google/refine/tests/io/ProjectMetadataTests.java new file mode 100644 index 000000000..e25e8aeaf --- /dev/null +++ b/main/tests/server/src/com/google/refine/tests/io/ProjectMetadataTests.java @@ -0,0 +1,22 @@ +package com.google.refine.tests.io; + +import java.io.IOException; +import java.io.InputStream; + +import org.apache.commons.io.IOUtils; +import org.testng.annotations.Test; + +import com.google.refine.model.metadata.ProjectMetadata; +import com.google.refine.tests.util.TestUtils; + +public class ProjectMetadataTests { + @Test + public void serializeProjectMetadata() throws IOException { + ProjectMetadata metadata = new ProjectMetadata(); + InputStream f = ProjectMetadataTests.class.getClassLoader().getResourceAsStream("example_project_metadata.json"); + String json = IOUtils.toString(f); + f = ProjectMetadataTests.class.getClassLoader().getResourceAsStream("example_project_metadata.json"); + metadata.loadFromStream(f); + TestUtils.isSerializedTo(metadata, json); + } +}