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.gs.collections.impl.jmh.map.TroveMutableMapGetTest.java

@Benchmark
public void get() {
    int localSize = this.size;
    String[] localElements = this.elements;
    TMap<String, String> localTroveMap = this.troveMap;

    for (int i = 0; i < localSize; i++) {
        if (localTroveMap.get(localElements[i]) == null) {
            throw new AssertionError(i);
        }/*from w  w w .  j a va  2  s  . c o m*/
    }
}

From source file:com.asakusafw.runtime.flow.ReducerWithRuntimeResource.java

@Override
public final void run(Context context) throws IOException, InterruptedException {
    this.resources = new RuntimeResourceManager(context.getConfiguration());
    resources.setup();//from  w ww.j a  v  a2 s . com
    try {
        runInternal(context);
    } catch (Throwable t) {
        oombuf = null;
        LOG.error(MessageFormat.format("error occurred while executing reducer: {0}", getClass().getName()), t);
        if (t instanceof Error) {
            throw (Error) t;
        } else if (t instanceof RuntimeException) {
            throw (RuntimeException) t;
        } else if (t instanceof IOException) {
            throw (IOException) t;
        } else if (t instanceof InterruptedException) {
            throw (InterruptedException) t;
        } else {
            throw new AssertionError(t);
        }
    } finally {
        this.resources.cleanup();
    }
}

From source file:io.pravega.test.system.framework.RemoteSequential.java

@Override
public CompletableFuture<Void> startTestExecution(Method testMethod) {

    log.debug("Starting test execution for method: {}", testMethod);

    String className = testMethod.getDeclaringClass().getName();
    String methodName = testMethod.getName();
    String jobId = (methodName + ".testJob").toLowerCase(); //All jobIds should have lowercase for metronome.

    return CompletableFuture.runAsync(() -> {
        CLIENT.createJob(newJob(jobId, className, methodName));
        Response response = CLIENT.triggerJobRun(jobId);
        if (response.status() != CREATED.code()) {
            throw new TestFrameworkException(TestFrameworkException.Type.ConnectionFailed,
                    "Error while starting " + "test " + testMethod);
        }//from  w  w  w . ja v a2 s.c  o m
    }).thenCompose(v2 -> waitForJobCompletion(jobId)).<Void>thenApply(v1 -> {
        if (CLIENT.getJob(jobId).getHistory().getFailureCount() != 0) {
            throw new AssertionError("Test failed, detailed logs can be found at "
                    + "https://MasterIP/mesos, under metronome framework tasks. MethodName: " + methodName);
        }
        return null;
    }).whenComplete((v, ex) -> {
        deleteJob(jobId); //deletejob once execution is complete.
        if (ex != null) {
            log.error("Error while executing the test. ClassName: {}, MethodName: {}", className, methodName);

        }
    });
}

From source file:com.moilioncircle.redis.replicator.EventHandlerWorker.java

@Override
public void run() {
    while (!isClosed.get() || replicator.eventQueue.size() > 0) {
        Object event = null;/*from  w  w w .j av a  2  s  . co  m*/
        try {
            event = replicator.eventQueue.poll(replicator.configuration.getPollTimeout(),
                    TimeUnit.MILLISECONDS);
            if (event == null) {
                continue;
            } else if (event instanceof KeyValuePair<?>) {
                KeyValuePair<?> kv = (KeyValuePair<?>) event;
                if (!replicator.doRdbFilter(kv))
                    continue;
                replicator.doRdbHandler(kv);
            } else if (event instanceof Command) {
                Command command = (Command) event;
                if (!replicator.doCommandFilter(command))
                    continue;
                replicator.doCommandHandler(command);
            } else if (event instanceof PreFullSyncEvent) {
                replicator.doPreFullSync();
            } else if (event instanceof PostFullSyncEvent) {
                replicator.doPostFullSync(((PostFullSyncEvent) event).getChecksum());
            } else {
                throw new AssertionError(event);
            }
        } catch (Throwable throwable) {
            try {
                replicator.doExceptionListener(throwable, event);
            } catch (Throwable e) {
                logger.error("error", e);
            }
        }
    }
    replicator.doCloseListener();
}

From source file:cz.lbenda.dataman.rc.DbConfigFactory.java

public static DbConfig getConfiguration(String configName) {
    if (configName == null) {
        throw new AssertionError("The parameter configName can't be null.");
    }// ww w  . ja  va2 s  .co m
    for (DbConfig sc : getConfigurations()) {
        if (configName.equals(sc.getId())) {
            return sc;
        }
    }
    return null;
}

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

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

From source file:com.gs.collections.impl.jmh.map.GscMutableMapGetTest.java

@Benchmark
public void get() {
    int localSize = this.size;
    String[] localElements = this.elements;
    MutableMap<String, String> localGscMap = this.gscMap;

    for (int i = 0; i < localSize; i++) {
        if (localGscMap.get(localElements[i]) == null) {
            throw new AssertionError(i);
        }//from www  .ja v a2  s . co m
    }
}

From source file:com.discovery.darchrow.util.Validator.java

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

From source file:com.wickettasks.business.services.user.TestUserService.java

@Test(expected = IllegalArgumentException.class)
public void emailAndPasswordAreMandatoryToCreateAnUser() {
    try {/*  w  w w  .ja v  a2  s . c  om*/
        this.userService.add(null, null);
    } catch (ExistingUserException e) {
        throw new AssertionError(e);
    }
}

From source file:com.gs.collections.impl.jmh.map.ScalaAnyRefMapGetTest.java

@Benchmark
public void get() {
    int localSize = this.size;
    String[] localElements = this.elements;
    Map<String, String> localScalaAnyRefMap = this.scalaAnyRefMap;

    for (int i = 0; i < localSize; i++) {
        if (!localScalaAnyRefMap.get(localElements[i]).isDefined()) {
            throw new AssertionError(i);
        }/*from ww w .j av  a 2s .  c o m*/
    }
}