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:de.unentscheidbar.csv2.CaseInsensitiveBenchmark.java

@Benchmark
public void ciMap() {

    CaseInsentiveMapData data = caseInsensitiveMapData;
    for (String key : data.keys.get(data.rnd.nextInt(data.keys.size()))) {
        if (data.map.get(key) == null)
            throw new AssertionError(key);
    }/* w ww .  java  2  s .c o  m*/
    if (data.map.get(invalidKey) != null)
        throw new AssertionError();
}

From source file:sit.web.client.HttpHelper.java

public static String decodeString(String myString) {
    if (myString == null) {
        throw new NullPointerException("decodeString: myString == null!");
    }/*from w ww.  ja v a  2s  .  co m*/
    try {
        return java.net.URLDecoder.decode(myString, "UTF-8");
    } catch (UnsupportedEncodingException ex) {
        throw new AssertionError("UTF-8 not supported");
    }
}

From source file:com.winify.happy_hours.converter.JacksonConverter.java

@Override
public TypedOutput toBody(Object object) {
    try {/*from   www .  ja  va  2s  .c o  m*/
        final String json = objectMapper.writeValueAsString(object);
        return new TypedByteArray(MIME_TYPE, json.getBytes(UTF_8));
    } catch (final JsonProcessingException e) {
        throw new AssertionError(e);
    } catch (final UnsupportedEncodingException e) {
        throw new AssertionError(e);
    }
}

From source file:tools.AssertingRestTemplate.java

@Override
protected <T> T doExecute(URI url, HttpMethod method, RequestCallback requestCallback,
        ResponseExtractor<T> responseExtractor) throws RestClientException {
    try {/*ww  w  .j a  v  a  2  s  .c  o  m*/
        return super.doExecute(url, method, requestCallback, responseExtractor);
    } catch (Exception e) {
        log.error("Exception occurred while sending the message to uri [" + url + "]. Exception ["
                + e.getCause() + "]");
        throw new AssertionError(e);
    }
}

From source file:com.qrmedia.commons.persistence.hibernate.clone.wiring.AbstractPropertyModifyingCommand.java

public void execute(IdentityHashMap<Object, Object> entityClones) {

    if (!entityClones.containsKey(originalEntity)) {
        throw new AssertionError("No clone for " + originalEntity + " available?!");
    }//from  w  ww  .  j ava  2  s  .  c  o  m

    wireUpProperty(target, propertyName, entityClones.get(originalEntity));
}

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

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

From source file:securitytools.common.http.TrustingSSLConnectionSocketFactory.java

@Override
public Socket connectSocket(int connectTimeout, Socket sock, HttpHost host, InetSocketAddress remoteAddress,
        InetSocketAddress localAddress, HttpContext context) throws IOException {
    if (sock == null) {
        sock = createSocket(context);//from www.ja va 2s  .  com
    }
    SSLSocket sslSocket = null;
    if (sock instanceof SSLSocket) {
        sslSocket = (SSLSocket) sock;
    } else {
        throw new AssertionError("Unexpected type: " + sock);
    }

    if (localAddress != null) {
        sslSocket.bind(localAddress);
    }

    sslSocket.connect(remoteAddress, connectTimeout);
    return sslSocket;
}

From source file:com.feilong.commons.core.io.CSVUtil.java

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

From source file:com.feilong.core.net.URLUtil.java

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

From source file:com.discovery.darchrow.http.ResponseUtil.java

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