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:org.jboss.aerogear.windows.mpns.internal.Utilities.java

public static byte[] toUTF8(String content) {
    try {/*  w  ww  . ja  v  a2 s  .  co  m*/
        return content.getBytes("UTF-8");
    } catch (UnsupportedEncodingException e) {
        throw new AssertionError("The world is coming to an end!  No UTF-8 support");
    }
}

From source file:com.brightcove.com.zartan.verifier.video.NonGeoFilteredVerifier.java

@ZartanCheck(value = "No geo filtered countires are set")
public ResultEnum assertNoCountriesCorrect(UploadData upData) throws Throwable {
    JsonNode actual = upData.getHttpResponseJson().get("geoFilteredCountries");
    if (!actual.isArray() || actual.size() != 0) {
        throw new AssertionError("Expected no filtered countries found : " + actual.toString());
    }//from   w w w .j av  a2 s.c o m

    return ResultEnum.PASS;
}

From source file:org.opf_labs.project.healthcheck.GitHubProjects.java

private GitHubProjects() {
    throw new AssertionError("In GitHubProjects constructor.");
}

From source file:com.github.kpavlov.commons.spring.annotations.TestConfig.java

@Bean
@Enabled("false")
String disabledBean() {
    throw new AssertionError("disabledBean must not be instantiated.");
}

From source file:edu.stanford.junction.provider.bluetooth.JunctionProvider.java

@Override
public URI generateSessionUri() {
    try {/*from ww w. j  a  v a 2  s  . co m*/
        //String uuid = UUID.randomUUID().toString();
        String uuid = mConfig.getUuid().toString();
        String mac = BluetoothAdapter.getDefaultAdapter().getAddress();
        return new URI("junction://" + mac + "/" + uuid + "#bt");
    } catch (URISyntaxException e) {
        throw new AssertionError("Invalid URI");
    }
}

From source file:com.appenginefan.toolkit.common.PayloadBuilder.java

/**
 * Builds the result and returns it as a string
 */// w w  w  .j a  va  2 s .  c om
public String toString() {
    try {
        object.put(TAG, payload);
        return object.toString();
    } catch (JSONException e) {
        throw new AssertionError("Cannot add json array to json object");
    }
}

From source file:com.discovery.darchrow.io.IOWriteUtil.java

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

From source file:org.primeframework.mvc.test.RequestResult.java

/**
 * Verifies that the body contains all of the given Strings.
 *
 * @param strings The strings to check./*from   ww  w . ja  v  a2s .  c o m*/
 * @return This.
 */
public RequestResult assertBodyContains(String... strings) {
    for (String string : strings) {
        if (!body.contains(string)) {
            throw new AssertionError(
                    "Body didn't contain [" + string + "]\nRedirect: [" + redirect + "]\nBody:\n" + body);
        }
    }

    return this;
}

From source file:htsjdk.variant.variantcontext.VariantContextUtils.java

/**
 * Computes the alternate allele frequency at the provided {@link VariantContext} by dividing its "AN" by its "AC".
 * @param vc The variant whose alternate allele frequency is computed
 * @return The alternate allele frequency in [0, 1]
 * @throws AssertionError When either annotation is missing, or when the compuated frequency is outside the expected range
 *///from   w w w.  j av  a2 s.c  o  m
public static double calculateAltAlleleFrequency(final VariantContext vc) {
    if (!vc.hasAttribute(VCFConstants.ALLELE_NUMBER_KEY) || !vc.hasAttribute(VCFConstants.ALLELE_COUNT_KEY))
        throw new AssertionError(String.format(
                "Cannot compute the provided variant's alt allele frequency because it does not have both %s and %s annotations: %s",
                VCFConstants.ALLELE_NUMBER_KEY, VCFConstants.ALLELE_COUNT_KEY, vc));
    final double altAlleleCount = vc.getAttributeAsInt(VCFConstants.ALLELE_COUNT_KEY, 0);
    final double totalCount = vc.getAttributeAsInt(VCFConstants.ALLELE_NUMBER_KEY, 0);
    final double aaf = altAlleleCount / totalCount;
    if (aaf > 1 || aaf < 0)
        throw new AssertionError(String
                .format("Expected a minor allele frequency in the range [0, 1], but got %s. vc=%s", aaf, vc));
    return aaf;
}

From source file:edu.stanford.junction.provider.jx.JunctionProvider.java

@Override
public URI generateSessionUri() {
    try {/*  w w  w  .  j  a  v a  2  s . com*/
        // Use local address as switchboard
        String sb = getLocalIpAddress();
        return new URI("junction://" + sb + "/" + UUID.randomUUID() + "#jx");
    } catch (Exception e) {
        throw new AssertionError("Invalid URI: " + e.getMessage());
    }
}