Example usage for java.lang AssertionError AssertionError

List of usage examples for java.lang AssertionError AssertionError

Introduction

In this page you can find the example usage for java.lang AssertionError AssertionError.

Prototype

public AssertionError(double detailMessage) 

Source Link

Document

Constructs an AssertionError with its detail message derived from the specified double, which is converted to a string as defined in section 15.18.1.1 of The Java™ Language Specification.

Usage

From source file:com.feilong.core.util.RegexUtil.java

/** Don't let anyone instantiate this class. */
private RegexUtil() {
    //AssertionError?. ?????. ???.
    //see Effective Java 2nd
    throw new AssertionError("No " + getClass().getName() + " instances for you!");
}

From source file:com.feilong.commons.core.configure.PropertiesUtil.java

/** Don't let anyone instantiate this class. */
private PropertiesUtil() {
    //AssertionError?. ?????. ???.
    //see Effective Java 2nd
    throw new AssertionError("No " + getClass().getName() + " instances for you!");
}

From source file:com.discovery.darchrow.lang.EnumUtil.java

/** Don't let anyone instantiate this class. */
private EnumUtil() {
    //AssertionError?. ?????. ???.
    //see Effective Java 2nd
    throw new AssertionError("No " + getClass().getName() + " instances for you!");
}

From source file:at.ac.univie.isc.asio.integration.IntegrationSettings.java

IntegrationSettings() {
    dslDefaults = new IntegrationDsl(new IntegrationDsl.SpecFactoryCallback() {
        @Override/*  ww w . ja va 2s.  c om*/
        public RequestSpecification requestFrom(final IntegrationDsl args) {
            throw new AssertionError("request creation outside of test scope");
        }
    });
}

From source file:net.incrementalism.tooter.User.java

private static String hash(String password) {
    // NOTE: Insecure! Don't use this in a real application
    try {//from   w ww  .j  a  va  2 s .c o m
        MessageDigest md = MessageDigest.getInstance("SHA");
        md.update(password.getBytes("UTF-8"));
        return Base64.encodeBase64String(md.digest());
    } catch (NoSuchAlgorithmException e) {
        throw new AssertionError("No SHA");
    } catch (UnsupportedEncodingException e) {
        throw new AssertionError("No UTF-8");
    }
}

From source file:com.discovery.darchrow.lang.ObjectUtil.java

/** Don't let anyone instantiate this class. */
private ObjectUtil() {
    //AssertionError?. ?????. ???.
    //see Effective Java 2nd
    throw new AssertionError("No " + getClass().getName() + " instances for you!");
}

From source file:com.discovery.darchrow.lang.ArrayUtil.java

/** Don't let anyone instantiate this class. */
private ArrayUtil() {
    //AssertionError?. ?????. ???.
    //see Effective Java 2nd
    throw new AssertionError("No " + getClass().getName() + " instances for you!");
}

From source file:com.feilong.core.util.predicate.BeanPredicateUtil.java

/** Don't let anyone instantiate this class. */
private BeanPredicateUtil() {
    //AssertionError?. ?????. ???.
    //see Effective Java 2nd
    throw new AssertionError("No " + getClass().getName() + " instances for you!");
}

From source file:com.feilong.core.text.NumberFormatUtil.java

/** Don't let anyone instantiate this class. */
private NumberFormatUtil() {
    //AssertionError?. ?????. ???.
    //see Effective Java 2nd
    throw new AssertionError("No " + getClass().getName() + " instances for you!");
}

From source file:org.thoughtcrime.ssl.pinning.util.PinningHelper.java

/**
 * Constructs an HttpClient that will validate SSL connections with a PinningTrustManager.
 *
 * @param pins An array of encoded pins to match a seen certificate
 *             chain against. A pin is a hex-encoded hash of a X.509 certificate's
 *             SubjectPublicKeyInfo. A pin can be generated using the provided pin.py
 *             script: python ./tools/pin.py certificate_file.pem
 *///from ww w. j  a  va2s.c  om

public static HttpClient getPinnedHttpClient(Context context, String[] pins) {
    try {
        SchemeRegistry schemeRegistry = new SchemeRegistry();
        schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
        schemeRegistry.register(new Scheme("https", new PinningSSLSocketFactory(context, pins, 0), 443));

        HttpParams httpParams = new BasicHttpParams();
        ClientConnectionManager connectionManager = new ThreadSafeClientConnManager(httpParams, schemeRegistry);
        return new DefaultHttpClient(connectionManager, httpParams);
    } catch (UnrecoverableKeyException e) {
        throw new AssertionError(e);
    } catch (KeyManagementException e) {
        throw new AssertionError(e);
    } catch (NoSuchAlgorithmException e) {
        throw new AssertionError(e);
    } catch (KeyStoreException e) {
        throw new AssertionError(e);
    }
}