Add project metadata serialization test
This commit is contained in:
parent
62190d36c0
commit
ac444b8b50
1
main/tests/data/example_project_metadata.json
Normal file
1
main/tests/data/example_project_metadata.json
Normal file
@ -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":""}
|
@ -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);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user