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:Main.java
private static URL makeURL(String id) { try {// ww w.ja v a 2 s .c o m String base = "http://share.findmespot.com/messageService/guestlinkservlet"; String full = String.format("%s?glId=%s&completeXml=true", base, id); return new URL(full); } catch (MalformedURLException mue) { // This shouldn't happen as we are in control of what the URL looks like. throw new AssertionError(mue); } }
From source file:Main.java
public static void sleep(long millis) { try {//from w ww.j a v a 2s . com Thread.sleep(millis); } catch (InterruptedException ie) { throw new AssertionError(ie); } }
From source file:Main.java
public static void wait(Object lock, long timeout) { try {//from w w w .ja v a 2 s. c om lock.wait(timeout); } catch (InterruptedException ie) { throw new AssertionError(ie); } }
From source file:Main.java
public static void sleepUninterrupted(long millis) { try {/*from w w w.j ava 2s . co m*/ Thread.currentThread().sleep(millis); } catch (InterruptedException ex) { throw new AssertionError(ex); } }
From source file:Main.java
public static byte[] getBytes(String fromString) { try {//from w ww. j a va 2 s . c om return fromString.getBytes("UTF8"); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } }
From source file:Main.java
public static String getString(byte[] fromBytes) { try {//from w ww .j av a 2 s. c o m return new String(fromBytes, "UTF8"); } catch (UnsupportedEncodingException e) { throw new AssertionError(e); } }
From source file:Main.java
public static SecureRandom getSecureRandom() { try {/*from www .j a va 2 s. c o m*/ return SecureRandom.getInstance("SHA1PRNG"); } catch (NoSuchAlgorithmException e) { throw new AssertionError(e); } }
From source file:Main.java
public static int getCurrentApkReleaseVersion(Context context) { try {// w ww .ja v a 2s . c o m return context.getPackageManager().getPackageInfo(context.getPackageName(), 0).versionCode; } catch (PackageManager.NameNotFoundException e) { throw new AssertionError(e); } }
From source file:Main.java
public static byte[] combine(byte[]... elements) { try {/*from w w w. j a v a 2 s. c om*/ ByteArrayOutputStream baos = new ByteArrayOutputStream(); for (byte[] element : elements) { baos.write(element); } return baos.toByteArray(); } catch (IOException e) { throw new AssertionError(e); } }
From source file:Main.java
/** count of days in the given month (one indexed) of the given year. */ public static int monthLength(int year, int month) { switch (month) { case 1://w ww . j a va 2s .c o m case 3: case 5: case 7: case 8: case 10: case 12: return 31; case 4: case 6: case 9: case 11: return 30; case 2: return isLeapYear(year) ? 29 : 28; default: throw new AssertionError(month); } }