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.apache.drill.optiq.DrillJoinRel.java
@Override public DrillJoinRel copy(RelTraitSet traitSet, RexNode condition, RelNode left, RelNode right) { try {/* w ww . j a v a2 s. c om*/ return new DrillJoinRel(getCluster(), traitSet, left, right, condition, joinType); } catch (InvalidRelException e) { throw new AssertionError(e); } }
From source file:com.feilong.core.util.EnumerationUtil.java
/** Don't let anyone instantiate this class. */ private EnumerationUtil() { //AssertionError?. ?????. ???. //see Effective Java 2nd throw new AssertionError("No " + getClass().getName() + " instances for you!"); }
From source file:com.wavemaker.runtime.data.parser.BaseHbmParser.java
protected String nextNested(String parentElementName, String... elementNames) { if (elementNames.length == 0) { // called like this by accident: nextNested("foo") // compiles because of varargs throw new AssertionError("nextNested requires at least 2 args"); }/*from w w w . j a v a 2s .co m*/ return nextInternal(parentElementName, -1, elementNames); }
From source file:Main.java
private static void assertContainsChildElement(Element expectedChild, Element actual, String messagePrefix, String... identifyingAttributes) { List<Element> childrenWithThatName = getDirectChildren(actual, expectedChild.getTagName()); if (childrenWithThatName.isEmpty()) { throw new AssertionError(messagePrefix + "\nThe child element " + printNodeOnly(expectedChild) + " was not found in the result " + printNodeOnly(actual)); }/*from ww w . j ava2 s . c o m*/ if (childrenWithThatName.size() == 1) { assertContains(expectedChild, childrenWithThatName.get(0), messagePrefix, identifyingAttributes); } else { String[] identifyingValues = getAttributeValues(expectedChild, identifyingAttributes); int expectedLocationInParent = getLocationInParent(expectedChild, identifyingAttributes, identifyingValues); Element actualChild = getNthElement(childrenWithThatName, identifyingAttributes, identifyingValues, expectedLocationInParent); if (actualChild == null) { throw new AssertionError(messagePrefix + "\nThe child element " + printNodeOnly(expectedChild) + " was not found in the result " + printNodeOnly(actual)); } else { assertContains(expectedChild, actualChild, messagePrefix, identifyingAttributes); } } }
From source file:com.jimkont.contactFix.provider.ProviderHTTPPost.java
/** * Connects to the server/* w w w . java 2 s . c o m*/ */ public static String executePost(String url, ArrayList<NameValuePair> params) { final ResponseHandler<String> responseHandler; HttpEntity entity = null; try { entity = new UrlEncodedFormEntity(params); } catch (final UnsupportedEncodingException e) { // this should never happen. throw new AssertionError(e); } final HttpPost post = new HttpPost(url); post.addHeader(entity.getContentType()); post.setEntity(entity); maybeCreateHttpClient(); try { responseHandler = new BasicResponseHandler(); String responseBody = mHttpClient.execute(post, responseHandler); return responseBody; } catch (final IOException e) { return null; } finally { } }
From source file:com.galeoconsulting.leonardinius.api.impl.ScriptSessionManagerImpl.java
@Override public SessionId putSession(ScriptSession session) { SessionId sessionId = Preconditions.checkNotNull(nextSessionId(), "nextSessionId"); if (cliSessions.putIfAbsent(sessionId, session) != null) { throw new AssertionError("Internal implementation bug: UUID considered to be unique enough."); }/*w ww . j av a2 s . co m*/ return sessionId; }
From source file:com.brightcove.com.zartan.verifier.video.EmptyCuePointVerifier.java
@ZartanCheck(value = "No cue points are set") public ResultEnum assertCuePointsCorrect(UploadData upData) throws Throwable { JsonNode actual = upData.getHttpResponseJson().get("cuePoints"); if (!actual.isArray() || actual.size() != 0) { throw new AssertionError("Expected no cuepoints found : " + actual.toString()); }//from w w w.j a v a2s.co m return ResultEnum.PASS; }
From source file:com.cedarsoft.serialization.test.utils.AbstractXmlSerializerMultiTest.java
@Override protected void verifySerialized(@Nonnull List<? extends byte[]> serialized) throws Exception { List<? extends String> expected = getExpectedSerialized(); int index = 0; for (byte[] current : serialized) { String expectedWithNamespace = AbstractXmlSerializerTest2.addNameSpace( (AbstractXmlSerializer<?, ?, ?, ?>) getSerializer(), expected.get(index).getBytes()); try {//from www . j av a2 s . c o m AssertUtils.assertXMLEquals(new String(current, getCharset()), expectedWithNamespace); } catch (AssertionError e) { AssertionError newError = new AssertionError("Failed for index <" + index + ">: " + e.getMessage()); newError.setStackTrace(e.getStackTrace()); throw newError; } index++; } }
From source file:mulavito.graph.AbstractLayerStack.java
/** * Adds a given graph / layer and trigger GUI update. * // w w w. j a va 2 s. co m * @param layer * The given layer. */ public void addLayer(L layer) { // Adds the graph to graph list. if (layers.add(layer)) fireStateChanged(new LayerChangedEvent<L>(this, layer, false)); else throw new AssertionError("graph"); }
From source file:net.javacrumbs.smock.extended.client.connection.MockConversation.java
/** * Throws {@link AssertionError} if more calls were expected. *//* w w w . j av a2 s . c om*/ public void verifyConnections() { if (activeConnection < expectedConnections.size()) { throw new AssertionError("Further connection(s) expected"); } }