Skip to content

Commit

Permalink
Moved the resource file of JsonJournalFormatterTest into package tach…
Browse files Browse the repository at this point in the history
…yon.master.journal
  • Loading branch information
yupeng9 committed Oct 15, 2015
1 parent 9ebc439 commit beb06fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Expand Up @@ -19,28 +19,29 @@
import java.io.IOException;
import java.util.Map;

import org.junit.Before;
import org.junit.Test;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.junit.BeforeClass;
import org.junit.Test;

public class JsonJournalFormatterTest extends JournalFormatterTestBase {

public static final String JSON_SAMPLE_PATH = "/JsonJournalEntries.json";
public static final String JSON_SAMPLE_PATH = "JsonJournalEntries.json";

private static JsonNode sRootNode;
private JsonNode mRootNode;

@Override
protected JournalFormatter getFormatter() {
return new JsonJournalFormatter();
}

@BeforeClass
public static void beforeClass() throws IOException {
@Before
public void beforeClass() throws IOException {
String entriesFile = JsonJournalFormatterTest.class.getResource(JSON_SAMPLE_PATH).getFile();
sRootNode = new ObjectMapper().readTree(new File(entriesFile));
mRootNode = new ObjectMapper().readTree(new File(entriesFile));
}

@Test
Expand All @@ -50,7 +51,7 @@ public void entriesJsonTest() throws IOException {

for (Map.Entry<JournalEntryType, JournalEntry> entry : mDataSet.entrySet()) {
JournalEntryType type = entry.getKey();
JsonNode n = sRootNode.get(type.toString());
JsonNode n = mRootNode.get(type.toString());
om.writeValue(mOs, n);
JournalEntry readEntry = read();
assertSameEntry(entry.getValue(), readEntry);
Expand Down

0 comments on commit beb06fe

Please sign in to comment.