private JSONObject extractJsonFromResponse(String response) throws JSONException { String defaultCruftMsg = "throw 1; < don't be evil' >"; assertStartsWith(defaultCruftMsg, response); response = response.substring(defaultCruftMsg.length()); return new JSONObject(response).getJSONObject(REQUEST_URL.toString()); }
@Then("^The downloaded file should have the same content as the local file \"([^\"]*)\"$") public void The_downloaded_file_should_have_the_same_content_as_the_local_file(String localFilePath) throws Throwable { FileAssert.assertEquals(new File(Context.LOCAL_TEST_DATA_PATH.resolve(localFilePath).toString()), new File(CURRENT_DOWNLOADED_FILE_PATH)); }
@Test public void testLatin1() { ArrayAssert.assertEquals(LATIN1_UTF8_DATA, CharsetUtil.getUtf8Bytes(LATIN1_STRING)); } }
public void testHashCode() { BasicOAuthStoreTokenIndex eq1 = new BasicOAuthStoreTokenIndex(); BasicOAuthStoreTokenIndex eq2 = new BasicOAuthStoreTokenIndex(); // just be sure that our new hashcode method works eq1.setModuleId(100); eq2.setModuleId(200); assertNotEquals(eq1.hashCode(), eq2.hashCode()); } }
@Test public void testDoGetNormalWithLockedDomainUnsafe() throws Exception { setupRequest(BASIC_SYNTAX_URL, false); replay(); servlet.doGet(request, recorder); verify(); assertEquals(HttpServletResponse.SC_BAD_REQUEST, recorder.getHttpStatusCode()); assertContains("wrong domain", recorder.getResponseAsString()); }
@Test public void testLatin1() { ArrayAssert.assertEquals(LATIN1_UTF8_DATA, CharsetUtil.getUtf8Bytes(LATIN1_STRING)); } }
public void testHashCode() { BasicOAuthStoreTokenIndex eq1 = new BasicOAuthStoreTokenIndex(); BasicOAuthStoreTokenIndex eq2 = new BasicOAuthStoreTokenIndex(); // just be sure that our new hashcode method works eq1.setModuleId(100); eq2.setModuleId(200); assertNotEquals(eq1.hashCode(), eq2.hashCode()); } }
private JSONObject extractJsonFromResponse(String response) throws JSONException { String defaultCruftMsg = "throw 1; < don't be evil' >"; assertStartsWith(defaultCruftMsg, response); response = response.substring(defaultCruftMsg.length()); return new JSONObject(response).getJSONObject(REQUEST_URL.toString()); }
@Test public void testLatin1() { ArrayAssert.assertEquals(LATIN1_UTF8_DATA, CharsetUtil.getUtf8Bytes(LATIN1_STRING)); } }
public void testHashCode() { BasicOAuthStoreTokenIndex eq1 = new BasicOAuthStoreTokenIndex(); BasicOAuthStoreTokenIndex eq2 = new BasicOAuthStoreTokenIndex(); // just be sure that our new hashcode method works eq1.setModuleId(100); eq2.setModuleId(200); assertNotEquals(eq1.hashCode(), eq2.hashCode()); } }
@Test public void testLatin1() { ArrayAssert.assertEquals(LATIN1_UTF8_DATA, CharsetUtil.getUtf8Bytes(LATIN1_STRING)); } }
@Test public void equalsAndHashCodeOk() { UriBuilder uri = UriBuilder.parse("http://example.org/foo/bar/baz?blah=blah#boo"); UriBuilder uri2 = new UriBuilder(Uri.parse("http://example.org/foo/bar/baz?blah=blah#boo")); assertEquals(uri, uri2); assertEquals(uri2, uri); assertEquals(uri, uri); assertNotNull(uri); assertNotEquals(uri, "http://example.org/foo/bar/baz?blah=blah#boo"); assertNotEquals(uri, Uri.parse("http://example.org/foo/bar/baz?blah=blah#boo")); assertEquals(uri.hashCode(), uri2.hashCode()); }
@Test public void testLatin1() { ArrayAssert.assertEquals(LATIN1_UTF8_DATA, CharsetUtil.getUtf8Bytes(LATIN1_STRING)); } }
@Test public void equalsAndHashCodeOk() { UriBuilder uri = UriBuilder.parse("http://example.org/foo/bar/baz?blah=blah#boo"); UriBuilder uri2 = new UriBuilder(Uri.parse("http://example.org/foo/bar/baz?blah=blah#boo")); assertEquals(uri, uri2); assertEquals(uri2, uri); assertEquals(uri, uri); assertNotNull(uri); assertNotEquals(uri, "http://example.org/foo/bar/baz?blah=blah#boo"); assertNotEquals(uri, Uri.parse("http://example.org/foo/bar/baz?blah=blah#boo")); assertEquals(uri.hashCode(), uri2.hashCode()); }
public void testConstruction() { ScuflModel model = new ScuflModel(); assertFalse(model.offline); ArrayAssert.assertEquals(new Processor[0], model.getProcessors()); ArrayAssert.assertEquals(new DataConstraint[0], model .getDataConstraints()); ArrayAssert.assertEquals(new ConcurrencyConstraint[0], model .getConcurrencyConstraints()); ArrayAssert.assertEquals(new ScuflModelEventListener[0], model .getListeners()); ArrayAssert.assertEquals(new Port[0], model.getWorkflowSinkPorts()); ArrayAssert.assertEquals(new Port[0], model.getWorkflowSourcePorts()); assertNotNull(model.getDescription()); // NOTE: the log level does not seem to be used for anything assertEquals(0, model.getLogLevel()); }
@Test public void testGetUtf8String() { ArrayAssert.assertEquals(new byte[] { 0x69, 0x6e }, CharsetUtil.getUtf8Bytes("in")); ArrayAssert.assertEquals(new byte[] {}, CharsetUtil.getUtf8Bytes(null)); testStringOfLength(0); testStringOfLength(10); testStringOfLength(100); testStringOfLength(1000); }
@Test public void testGetUtf8String() { ArrayAssert.assertEquals(new byte[] { 0x69, 0x6e }, CharsetUtil.getUtf8Bytes("in")); ArrayAssert.assertEquals(new byte[] {}, CharsetUtil.getUtf8Bytes(null)); testStringOfLength(0); testStringOfLength(10); testStringOfLength(100); testStringOfLength(1000); }
@Test public void testGetUtf8String() { ArrayAssert.assertEquals(new byte[] { 0x69, 0x6e }, CharsetUtil.getUtf8Bytes("in")); ArrayAssert.assertEquals(ArrayUtils.EMPTY_BYTE_ARRAY, CharsetUtil.getUtf8Bytes(null)); testStringOfLength(0); testStringOfLength(10); testStringOfLength(100); testStringOfLength(1000); }
@Test public void testGetUtf8String() { ArrayAssert.assertEquals(new byte[] { 0x69, 0x6e }, CharsetUtil.getUtf8Bytes("in")); ArrayAssert.assertEquals(ArrayUtils.EMPTY_BYTE_ARRAY, CharsetUtil.getUtf8Bytes(null)); testStringOfLength(0); testStringOfLength(10); testStringOfLength(100); testStringOfLength(1000); }
@Test public void testGetUtf8String() { ArrayAssert.assertEquals(new byte[] { 0x69, 0x6e }, CharsetUtil.getUtf8Bytes("in")); ArrayAssert.assertEquals(ArrayUtils.EMPTY_BYTE_ARRAY, CharsetUtil.getUtf8Bytes(null)); testStringOfLength(0); testStringOfLength(10); testStringOfLength(100); testStringOfLength(1000); }