List of usage examples for java.lang AssertionError AssertionError
public AssertionError(double detailMessage)
double
, which is converted to a string as defined in section 15.18.1.1 of The Java™ Language Specification. From source file:org.primeframework.mvc.test.RequestResult.java
/** * Verifies that the body is empty./* w ww . ja va 2 s.co m*/ * * @return This */ public RequestResult assertBodyIsEmpty() { if (!body.isEmpty()) { throw new AssertionError("Body is not empty.\nBody:\n" + body); } return this; }
From source file:at.ac.univie.isc.asio.insight.VndError.java
private static AssertionError circularPlaceholder(final Throwable throwable) { return new AssertionError(Pretty.format("[CIRCULAR REFERENCE : %s]", throwable)); }
From source file:com.v4creations.tmd.system.api.JSONConverter.java
@Override public TypedOutput toBody(Object object) { try {/* w w w .j a v a 2 s . c o m*/ return new JsonTypedOutput(gson.toJson(object).getBytes(encoding), encoding); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } }
From source file:net.algart.simagis.live.json.minimal.SimagisLiveUtils.java
public static JSONObject putError(JSONObject object, Throwable x) { try {//w w w. ja v a 2 s .c om object.put("error", toJSONError(x, null)); } catch (JSONException e) { throw new AssertionError(e); } return object; }
From source file:com.wickettasks.business.services.user.TestUserService.java
@Test public void testFindUserByEmail() { User user = null;/*from ww w .j a va2s .com*/ try { user = this.userService.add("test2@email.com", "password"); } catch (ExistingUserException e) { throw new AssertionError(e); } User foundUser = this.userService.findByEmail(user.getEmail()); assertEquals(user, foundUser); }
From source file:org.cruk.genologics.api.jaxb.URIAdapter.java
/** * Remove any "state=" parameter from the given URI. * * @param uri The URI to modify./*from ww w.j a v a 2 s. c om*/ * * @return A new URI which is {@code uri} without the state information. */ public static URI removeStateParameter(URI uri) { if (uri != null) { try { uri = new URI(removeStateParameter(uri.toString())); } catch (URISyntaxException e) { throw new AssertionError( "Removing state information from URI " + uri + " failed: " + e.getMessage()); } } return uri; }
From source file:com.feilong.taglib.display.breadcrumb.BreadCrumbUtil.java
/** Don't let anyone instantiate this class. */ private BreadCrumbUtil() { //AssertionError?. ?????. ???. //see Effective Java 2nd throw new AssertionError("No " + getClass().getName() + " instances for you!"); }
From source file:org.ff4j.spring.boot.resources.AbstractStepDef.java
protected void constructRequestBuilder(String path, String httpMethod, String contentType) { switch (HttpMethod.getHttpMethod(httpMethod)) { case GET://from www. j ava 2 s . co m requestBuilder = MockMvcRequestBuilders.get(path).contentType(MediaType.valueOf(contentType)); break; case PUT: requestBuilder = MockMvcRequestBuilders.put(path).contentType(MediaType.valueOf(contentType)); break; case DELETE: requestBuilder = MockMvcRequestBuilders.delete(path).contentType(MediaType.valueOf(contentType)); break; case POST: requestBuilder = MockMvcRequestBuilders.post(path).contentType(MediaType.valueOf(contentType)); break; default: throw new AssertionError("http method not found"); } }
From source file:com.predic8.membrane.examples.tests.LoggingJDBCTest.java
private void copyDerbyJarToMembraneLib() throws IOException { String classJar = getClass()//from www .j a v a 2s. com .getResource("/" + "org.apache.derby.jdbc.EmbeddedDriver".replace('.', '/') + ".class").getPath(); File derbyJar = new File(classJar.split("!")[0].substring(Process2.isWindows() ? 6 : 5)); if (!derbyJar.exists()) throw new AssertionError( "derby jar not found in classpath (it's either missing or the detection logic broken). classJar=" + classJar); copyFileToDirectory(derbyJar, new File(getMembraneHome(), "lib")); }
From source file:org.elasticsearch.smoketest.SmokeTestWatcherWithSecurityIT.java
@Before public void startWatcher() throws Exception { StringEntity entity = new StringEntity("{ \"value\" : \"15\" }", ContentType.APPLICATION_JSON); assertOK(adminClient().performRequest("PUT", "my_test_index/doc/1", Collections.singletonMap("refresh", "true"), entity)); // delete the watcher history to not clutter with entries from other test adminClient().performRequest("DELETE", ".watcher-history-*", Collections.emptyMap()); // create one document in this index, so we can test in the YAML tests, that the index cannot be accessed Response resp = adminClient().performRequest("PUT", "/index_not_allowed_to_read/doc/1", Collections.emptyMap(), new StringEntity("{\"foo\":\"bar\"}", ContentType.APPLICATION_JSON)); assertThat(resp.getStatusLine().getStatusCode(), is(201)); assertBusy(() -> {//w w w .java 2 s. co m try { Response statsResponse = adminClient().performRequest("GET", "_xpack/watcher/stats"); ObjectPath objectPath = ObjectPath.createFromResponse(statsResponse); String state = objectPath.evaluate("stats.0.watcher_state"); switch (state) { case "stopped": Response startResponse = adminClient().performRequest("POST", "_xpack/watcher/_start"); assertOK(startResponse); String body = EntityUtils.toString(startResponse.getEntity()); assertThat(body, containsString("\"acknowledged\":true")); break; case "stopping": throw new AssertionError("waiting until stopping state reached stopped state to start again"); case "starting": throw new AssertionError("waiting until starting state reached started state"); case "started": // all good here, we are done break; default: throw new AssertionError("unknown state[" + state + "]"); } } catch (IOException e) { throw new AssertionError(e); } }); assertBusy(() -> { for (String template : WatcherIndexTemplateRegistryField.TEMPLATE_NAMES) { assertOK(adminClient().performRequest("HEAD", "_template/" + template)); } }); }