Created
October 11, 2012 08:03
-
-
Save oschrenk/3870891 to your computer and use it in GitHub Desktop.
Testing with JUnit/Maven
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static org.junit.Assert.*; | |
import java.io.File; | |
import java.io.IOException; | |
import org.junit.Before; | |
import org.junit.Test; | |
import com.google.common.base.CharMatcher; | |
import com.google.common.base.Charsets; | |
import com.google.common.io.Files; | |
public class JsonEqivalenceTest { | |
/** The Constant JSON_PATH. */ | |
private static final String JSON_PATH="/path/to/file.json"; | |
@Test | |
public void testEqivalence() throws IOException { | |
final File inputFile=new File(this.getClass().getResource(JSON_PATH).getFile()); | |
final String input=CharMatcher.WHITESPACE.removeFrom(Files.toString(inputFile, Charsets.UTF_8)); | |
parse(inputFile); | |
final String output=CharMatcher.WHITESPACE.removeFrom(gson.toJson(action)); | |
assertEquals(input, output); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment