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:com.run.mapred.hbase2tsv.HFileInputFormat_mr2.java
private static byte[] decodeHexOrDie(String s) { try {//from w w w. j ava 2 s.co m return Hex.decodeHex(s.toCharArray()); } catch (DecoderException e) { throw new AssertionError("Failed to decode hex string: " + s); } }
From source file:net.algart.simagis.live.json.minimal.SimagisLiveUtils.java
public static JSONObject parseArgs(String... args) { final Pattern[] opts = new Pattern[] { Pattern.compile("^--([\\w\\d\\-]++)"), Pattern.compile("^-([\\w\\d\\-]++)"), Pattern.compile("^--([\\w\\d\\-]++)=(.*)"), Pattern.compile("^-([\\w\\d\\-]++)=(.*)") }; final JSONObject result = new JSONObject(); final JSONArray resultArgs = openArray(result, "args"); final JSONArray resultValues = openArray(result, "values"); final JSONObject options = openObject(result, "options"); args: for (final String arg : args) { resultArgs.put(arg);/* w w w. j a va2 s.c o m*/ for (final Pattern opt : opts) { final Matcher matcher = opt.matcher(arg); if (matcher.matches()) { try { switch (matcher.groupCount()) { case 1: options.put(matcher.group(1), true); break; case 2: options.put(matcher.group(1), matcher.group(2)); break; } } catch (JSONException e) { throw new AssertionError(e); } continue args; } } resultValues.put(arg); } return result; }
From source file:jsst.core.client.handler.impl.HTTPHandler.java
@Override public void handle(HTTPServerResponse response) throws HandlerException { if (response.getStatusCode() == 404) throw new HandlerException("Page \"" + response.getUrl() + "\" is not available. " + "Seems like war with tests is either not deployed or " + "is deployed under different context-path from the one in jsst.properties"); try {/*from w w w . ja v a2 s .c o m*/ JSONObject jsonObject = new JSONObject(response.getMessage()); String jsonStatus = jsonObject.getString(RESPONSE_STATUS); Status status; try { status = Status.valueOf(jsonStatus); } catch (IllegalArgumentException e) { throw new HandlerException("Couldn't recognize status \"" + jsonStatus + "\"", e); } switch (status) { case SUCCESS: return; case FAIL: String throwable = jsonObject.getString(RESPONSE_THROWABLE); throw new AssertionError(throwable); default: throw new UnsupportedOperationException(); } } catch (JSONException e) { throw new HandlerException("Exception occurred while parsing server response", e); } }
From source file:net.javacrumbs.smock.extended.client.connection.MockConversation.java
/** * Returns connection to process a request. * @return/*from w w w . j a va2 s . c o m*/ */ public MockConnection getActiveConnection() { if (activeConnection >= expectedConnections.size()) { throw new AssertionError("No further connections expected"); } MockConnection connection = expectedConnections.get(activeConnection); activeConnection++; return connection; }
From source file:io.inkstand.scribble.rules.TemporaryFile.java
@Override protected void before() throws Throwable { file = folder.newFile(filename);/* ww w .java2 s . co m*/ if (forceContent && contentUrl == null) { throw new AssertionError("ContentUrl is not set"); } else if (contentUrl != null) { try (InputStream is = contentUrl.openStream(); OutputStream os = new FileOutputStream(file)) { IOUtils.copy(is, os); } } }
From source file:com.sunchenbin.store.feilong.core.io.MimeTypeUtil.java
/** Don't let anyone instantiate this class. */ private MimeTypeUtil() { //AssertionError?. ?????. ???. //see Effective Java 2nd throw new AssertionError("No " + getClass().getName() + " instances for you!"); }
From source file:org.apache.drill.optiq.DrillAggregateRel.java
@Override public RelNode copy(RelTraitSet traitSet, List<RelNode> inputs) { try {//from w w w . j av a 2 s .co m return new DrillAggregateRel(getCluster(), traitSet, sole(inputs), getGroupSet(), aggCalls); } catch (InvalidRelException e) { throw new AssertionError(e); } }
From source file:com.appenginefan.toolkit.common.PayloadBuilder.java
public PayloadBuilder setProperty(String key, String value) { if (key.equals(TAG)) { throw new IllegalArgumentException("Illegal tag: " + key); }//w w w .ja v a 2 s . c o m try { object.put(key, value); } catch (JSONException e) { throw new AssertionError("Cannot add as string to json object"); } return this; }
From source file:com.feilong.commons.core.util.RandomUtil.java
/** Don't let anyone instantiate this class. */ private RandomUtil() { //AssertionError?. ?????. ???. //see Effective Java 2nd throw new AssertionError("No " + getClass().getName() + " instances for you!"); }
From source file:gmc.hotplate.logic.LocalDataManager.java
@Override public List<Ingredient> getProductsList(int type, int limit) { throw new AssertionError("Not implemented yet!"); }