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.hp.autonomy.hod.client.api.authentication.AuthenticationServiceITCase.java

@Override
@Before//from  w  ww.j a  v  a  2  s  . c  o  m
public void setUp() {
    super.setUp();
    authenticationService = new AuthenticationServiceImpl(getConfig());

    try {
        tenantUuid = authenticationService.getApplicationTokenInformation(getTokenProxy()).getTenantUuid();
    } catch (final HodErrorException e) {
        throw new AssertionError("Could not determine tenant UUID");
    }
}

From source file:com.evolveum.midpoint.wf.util.ApprovalUtils.java

public static String toUri(ApprovalLevelOutcomeType outcome) {
    if (outcome == null) {
        return null;
    }/*w  ww.  j a v a 2s  .c  o m*/
    switch (outcome) {
    case APPROVE:
        return SchemaConstants.MODEL_APPROVAL_OUTCOME_APPROVE;
    case REJECT:
        return SchemaConstants.MODEL_APPROVAL_OUTCOME_REJECT;
    case SKIP:
        return SchemaConstants.MODEL_APPROVAL_OUTCOME_SKIP;
    default:
        throw new AssertionError("Unexpected outcome: " + outcome);
    }
}

From source file:com.opentable.logging.LogMetadataTest.java

@Before
public void addHandler() throws Exception {
    mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

    serializedEvents.clear();/*from   w  w w. j av a  2s  . co m*/

    final OnConsoleStatusListener listener = new OnConsoleStatusListener();
    listener.start();
    context.getStatusManager().add(listener);

    final JsonLogEncoder encoder = new JsonLogEncoder() {
        @Override
        protected void writeJsonNode(ObjectNode logLine) throws IOException {
            serializedEvents.add(mapper.valueToTree(logLine));
        }
    };
    encoder.setContext(context);

    final UnsynchronizedAppenderBase<ILoggingEvent> captureAppender = new UnsynchronizedAppenderBase<ILoggingEvent>() {
        @Override
        protected void append(ILoggingEvent eventObject) {
            try {
                encoder.doEncode(eventObject);
            } catch (IOException e) {
                throw new AssertionError(e);
            }
        }
    };
    captureAppender.setContext(context);
    captureAppender.start();

    context.getLogger(Logger.ROOT_LOGGER_NAME).addAppender(captureAppender);
    BasicConfigurator.configure(context);
    context.start();
}

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

@ZartanCheck(value = "No ad keys are set")
public ResultEnum assertAdKeysCorrect(UploadData upData) throws Throwable {
    JsonNode actual = upData.getHttpResponseJson().get("adKeys");
    if (!actual.isNull()) {
        throw new AssertionError("Expected no adKeys found : " + actual.toString());
    }//  ww  w .  jav a 2 s  .c o  m

    return ResultEnum.PASS;
}

From source file:com.feilong.core.Alphabet.java

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

From source file:fi.jumi.launcher.JumiBootstrap.java

public void runSuite(SuiteConfiguration suite, DaemonConfiguration daemon)
        throws IOException, InterruptedException {
    try (JumiLauncher launcher = createLauncher()) {
        launcher.start(suite, daemon);/*from w  w  w .  ja  v a2 s . co m*/

        TextUI ui = new TextUI(launcher.getEventStream(), new PlainTextPrinter(textUiOutput));
        ui.setPassingTestsVisible(passingTestsVisible);
        ui.updateUntilFinished();

        if (ui.hasFailures()) {
            throw new AssertionError("There were test failures");
        }
    }
}

From source file:org.apache.empire.samples.spring.support.EmpireDaoSupport.java

public boolean databaseExists() {
    Connection conn = getConnection();
    try {// ww  w .j  a  v a2s  .  c o m
        DBDatabase db = getDatabase();
        if (db.getTables() == null || db.getTables().isEmpty()) {
            throw new AssertionError("There are no tables in this database!");
        }
        DBCommand cmd = db.createCommand();
        if (cmd == null) {
            throw new AssertionError("The DBCommand object is null.");
        }
        DBTable t = db.getTables().get(0);
        cmd.select(t.count());
        return (db.querySingleInt(cmd, -1, conn) >= 0);
    } catch (Exception e) {
        return false;
    }
}

From source file:org.cloudfoundry.caldecott.client.TunnelHelper.java

private TunnelHelper() {
    throw new AssertionError("Helper class should not be instantiated.");
}

From source file:mulavito.algorithms.shortestpath.ShortestPathAlgorithm.java

@Override
public final Map<V, E> getIncomingEdgeMap(V source) {
    throw new AssertionError("not implemented");
}

From source file:com.tingtingapps.securesms.crypto.PreKeyUtil.java

public static SignedPreKeyRecord generateSignedPreKey(Context context, IdentityKeyPair identityKeyPair) {
    try {//w w  w .jav  a2  s  .c o  m
        SignedPreKeyStore signedPreKeyStore = new TextSecurePreKeyStore(context);
        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);
    }
}