Commits

Luke Hoersten committed f3a1b7f

Added more unit tests.

  • Participants
  • Parent commits 9d1c2b4

Comments (0)

Files changed (1)

File test/org/discoproject/test/DiscoTest.java

 	}
 
 	@Test
-	public void testB64Encoding() {
+	public void testB64Encoding() throws IOException {
 		final String json = "{\"entryexitlevel\":[\"DEC\",1.5],\"qr2\":[\"DEC\",1],\"qr1\":[\"DEC\",1.0E-5],\"enterexitwindow\":[\"STR\",\"'2 hours'\"],\"VarientNumber\":1}";
 		final String expected = "raw://eyJlbnRyeWV4aXRsZXZlbCI6WyJERUMiLDEuNV0sInFyMiI6WyJERUMiLDFdLCJxcjEiOlsiREVDIiwxLjBFLTVdLCJlbnRlcmV4aXR3aW5kb3ciOlsiU1RSIiwiJzIgaG91cnMnIl0sIlZhcmllbnROdW1iZXIiOjF9";
 
 		final String actual = DiscoUtils.encodeRaw(json);
 		assertEquals(expected, actual);
-	}
 
-	@Test
-	public void testB64Decoding() throws IOException {
-		final String raw = "eyJlbnRyeWV4aXRsZXZlbCI6WyJERUMiLDEuNV0sInFyMiI6WyJERUMiLDFdLCJxcjEiOlsiREVDIiwxLjBFLTVdLCJlbnRlcmV4aXR3aW5kb3ciOlsiU1RSIiwiJzIgaG91cnMnIl0sIlZhcmllbnROdW1iZXIiOjF9";
-		final String expected = "{\"entryexitlevel\":[\"DEC\",1.5],\"qr2\":[\"DEC\",1],\"qr1\":[\"DEC\",1.0E-5],\"enterexitwindow\":[\"STR\",\"'2 hours'\"],\"VarientNumber\":1}";
-
-		final String actual = DiscoUtils.decodeRaw(raw);
-		assertEquals(expected, actual);
+		final String raw = expected.substring(6);
+		final String actualDecode = DiscoUtils.decodeRaw(raw);
+		assertEquals(json, actualDecode);
 	}
 
 	private class NullByteChannel implements WritableByteChannel {