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.discovery.darchrow.net.ParamUtil.java

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

From source file:com.predic8.membrane.core.multipart.ReassembleTest.java

@Test
public void doit() throws HttpException, IOException, SAXException, XMLStreamException {
    String actual = IOUtils.toString(new XOPReconstitutor().reconstituteIfNecessary(getResponse()));
    String expected = IOUtils/*from   w w w  .  ja  v  a  2  s .c o  m*/
            .toString(getClass().getResourceAsStream("/multipart/embedded-byte-array-reassembled.xml"));

    if (actual.startsWith("--"))
        throw new AssertionError("Response was not reassembled: " + actual);

    XMLAssert.assertXMLEqual(expected, actual);
}

From source file:dbs_project.util.Utils.java

private Utils() {
    throw new AssertionError("fail.");
}

From source file:com.android.volley.toolbox.RequestFuture.java

@Override
public T get() throws InterruptedException, ExecutionException {
    try {/*from  w  w  w .ja  v a2 s  .co  m*/
        return doGet(null);
    } catch (TimeoutException e) {
        throw new AssertionError(e);
    }
}

From source file:org.thoughtcrime.SMP.crypto.PreKeyUtil.java

public static SignedPreKeyRecord generateSignedPreKey(Context context, MasterSecret masterSecret,
        IdentityKeyPair identityKeyPair) {
    try {/*from   w w w  .j av a 2s  .  c o  m*/
        SignedPreKeyStore signedPreKeyStore = new TextSecurePreKeyStore(context, masterSecret);
        int signedPreKeyId = getNextSignedPreKeyId(context);
        ECKeyPair keyPair = Curve.generateKeyPair();
        byte[] signature = Curve.calculateSignature(identityKeyPair.getPrivateKey(),
                keyPair.getPublicKey().serialize());
        SignedPreKeyRecord record = new SignedPreKeyRecord(signedPreKeyId, System.currentTimeMillis(), keyPair,
                signature);

        signedPreKeyStore.storeSignedPreKey(signedPreKeyId, record);
        setNextSignedPreKeyId(context, (signedPreKeyId + 1) % Medium.MAX_VALUE);

        return record;
    } catch (InvalidKeyException e) {
        throw new AssertionError(e);
    }
}

From source file:org.smssecure.smssecure.crypto.PreKeyUtil.java

public static SignedPreKeyRecord generateSignedPreKey(Context context, MasterSecret masterSecret,
        IdentityKeyPair identityKeyPair) {
    try {/*from w  w w  .j  a va2s .c  om*/
        SignedPreKeyStore signedPreKeyStore = new SilencePreKeyStore(context, masterSecret);
        int signedPreKeyId = getNextSignedPreKeyId(context);
        ECKeyPair keyPair = Curve.generateKeyPair();
        byte[] signature = Curve.calculateSignature(identityKeyPair.getPrivateKey(),
                keyPair.getPublicKey().serialize());
        SignedPreKeyRecord record = new SignedPreKeyRecord(signedPreKeyId, System.currentTimeMillis(), keyPair,
                signature);

        signedPreKeyStore.storeSignedPreKey(signedPreKeyId, record);
        setNextSignedPreKeyId(context, (signedPreKeyId + 1) % Medium.MAX_VALUE);

        return record;
    } catch (InvalidKeyException e) {
        throw new AssertionError(e);
    }
}

From source file:eu.swiec.bearballin.common.io.FileIO.java

public static void getTestParamsFromCSVFile(File paramsFile, List<List<String>> paramsList,
        List<String> jobsNames) throws IOException {

    BufferedReader bufRdr;// w ww . ja  v a 2 s .c om

    try {
        bufRdr = new BufferedReader(new FileReader(paramsFile));
        String TestType = paramsFile.getParentFile().getName();
        List<String> singleTestCaseParameters;

        String line = null;
        String[] splitedLine;
        while ((line = bufRdr.readLine()) != null) {
            splitedLine = line.split(",");
            singleTestCaseParameters = new ArrayList<String>(10);
            singleTestCaseParameters.add(TestType);
            for (String sp : splitedLine) {
                singleTestCaseParameters.add(sp);
            }
            jobsNames.add(singleTestCaseParameters.get(0) + "_" + singleTestCaseParameters.get(1));
            paramsList.add(singleTestCaseParameters);
        }
        bufRdr.close();
    } catch (Exception e) {
        e.printStackTrace();
        AssertionError ae = new AssertionError("RB system failed to generate end-user message");
        ae.initCause(e);
        throw ae;
    }
}

From source file:org.elasticsearch.smoketest.SmokeTestWatcherTestSuiteIT.java

@Before
public void startWatcher() throws Exception {
    // delete the watcher history to not clutter with entries from other test
    assertOK(adminClient().performRequest("DELETE", ".watcher-history-*"));

    assertBusy(() -> {/*from w  ww.  j a  v a  2 s  . com*/
        Response response = adminClient().performRequest("GET", "_xpack/watcher/stats");
        String state = ObjectPath.createFromResponse(response).evaluate("stats.0.watcher_state");

        switch (state) {
        case "stopped":
            Response startResponse = adminClient().performRequest("POST", "/_xpack/watcher/_start");
            boolean isAcknowledged = ObjectPath.createFromResponse(startResponse).evaluate("acknowledged");
            assertThat(isAcknowledged, is(true));
            break;
        case "stopping":
            throw new AssertionError("waiting until stopping state reached stopped state to start again");
        case "starting":
            throw new AssertionError("waiting until starting state reached started state");
        case "started":
            // all good here, we are done
            break;
        default:
            throw new AssertionError("unknown state[" + state + "]");
        }
    });

    assertBusy(() -> {
        for (String template : WatcherIndexTemplateRegistryField.TEMPLATE_NAMES) {
            Response templateExistsResponse = adminClient().performRequest("HEAD", "_template/" + template,
                    emptyMap());
            assertThat(templateExistsResponse.getStatusLine().getStatusCode(), is(200));
        }
    });
}

From source file:edu.umd.cs.findbugs.StringAnnotation.java

@Override
public Object clone() {
    try {/*w w  w.j  a va  2  s .  c o m*/
        return super.clone();
    } catch (CloneNotSupportedException e) {
        throw new AssertionError(e);
    }
}

From source file:org.apache.drill.optiq.DrillSortRel.java

private static String toDrill(RelFieldCollation collation) {
    switch (collation.getDirection()) {
    case Ascending:
        return "asc";
    case Descending:
        return "desc";
    default://  w w  w . j  a  v  a 2 s  .  co m
        throw new AssertionError(collation.getDirection());
    }
}