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.HppcMutableMapGetTest.java

@Benchmark
public void get() {
    int localSize = this.size;
    String[] localElements = this.elements;
    ObjectObjectMap<String, String> localHppcMap = this.hppcMap;

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

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

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

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

From source file:com.asakusafw.yaess.basic.BasicScriptHandlerTestRoot.java

/**
 * Executes a script.//from w  ww . j a  v a2  s  . co  m
 * @param <T> script kind
 * @param context current context
 * @param script target script
 * @param handler target handler
 */
protected <T extends ExecutionScript> void execute(ExecutionContext context, T script,
        ExecutionScriptHandler<T> handler) {
    try {
        handler.execute(ExecutionMonitor.NULL, context, script);
    } catch (InterruptedException e) {
        throw new AssertionError(e);
    } catch (IOException e) {
        e.printStackTrace();
        Assume.assumeNoException(e);
    }
}

From source file:cognition.pipeline.sanity.AnonymisationSanityChecker.java

@PostConstruct
public void checkBasicAnonymisationRules() throws ParseException {
    Individual individual = new Individual();
    individual.addForeName("TestName1");
    individual.addForeName("TestName2");
    individual.addSurname("TestLastName1");
    individual.addSurname("TestLastName1");
    individual.addNhsNumber("11122");
    PatientAddress patientAddress1 = new PatientAddress();
    patientAddress1.setAddress("Kidderpore Avenue Hampstead, London");
    patientAddress1.setPostCode("cb4 2za");
    PatientAddress patientAddress2 = new PatientAddress();
    patientAddress2.setAddress("addressText");
    patientAddress2.setPostCode("cb4 2za");
    individual.addAddress(patientAddress1);
    individual.addAddress(patientAddress2);
    individual.addPhoneNumber("50090051234");
    individual.addPhoneNumber("11090051234");
    individual.addDateOfBirth(TimeUtil.getDateFromString("09/05/1990", "dd/MM/yyyy"));

    String anonymisedText = anonymisationService.pseudonymisePersonPlainText(individual,
            "\n" + "\n" + "TestName1 TestName2 TestLastName1 TestLastName2\n" + "\n" + "\n" + "11122\n"
                    + "50090051234" + "\n 09/05/1990" + "\n" + "cb42za"
                    + " Some random text that should not be anonymised. \n"
                    + "Address is Kidderpore Ave, (Hampstead, London.");
    System.out.println(anonymisedText);
    if (anonymisedText.contains("TestName1") || anonymisedText.contains("TestName2")) {
        throw new AssertionError(
                "First name pseudonymisation is not working! Please check config/anonymisation/nameRules");
    }/*from w  w w.  j av a  2  s  .com*/
    if (anonymisedText.contains("TestLastName1") || anonymisedText.contains("TestLastName2")) {
        throw new AssertionError(
                "Last name pseudonymisation is not working! Please check config/anonymisation/nameRules");
    }
    if (anonymisedText.contains("11122")) {
        throw new AssertionError(
                "NHS Number pseudonymisation is not working! Please check config/anonymisation/nhsIdRules");
    }
    if (anonymisedText.contains("50090051234")) {
        throw new AssertionError(
                "Phone number pseudonymisation is not working! Please check config/anonymisation/phoneRules");
    }
    if (anonymisedText.contains("09/05/1990")) {
        throw new AssertionError(
                "Date of birth pseudonymisation is not working! Please check config/anonymisation/dateOfBirthRules");
    }
    if (anonymisedText.contains("cb42za")) {
        throw new AssertionError(
                "Post code pseudonymisation is not working! Please check config/anonymisation/addressRules");
    }
    if (!anonymisedText.contains("Some random text that should not be anonymised.")) {
        throw new AssertionError("Pseudonymisation rules anonymise everything? Please check your rules!");
    }

    if (!anonymisedText.contains("Address is AAAAA")) {
        throw new AssertionError(
                "Approximate address pseudonymisation is not working. Please check config/anonymisation/addressRules!");
    }
}

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

@Benchmark
public void get() {
    int localSize = this.size;
    String[] localElements = this.elements;
    ObjObjMap<String, String> localKolobokeMap = this.kolobokeMap;

    for (int i = 0; i < localSize; i++) {
        if (localKolobokeMap.get(localElements[i]) == null) {
            throw new AssertionError(i);
        }//from   www  . j av  a 2 s  .  c om
    }
}

From source file:org.ff4j.services.ff4j.FF4JServicesStepDef.java

@Given("^the feature store has the following security information$")
public void the_feature_store_has_the_following_security_information(
        List<TestAuthorizationsManager> authorizationsManagers) throws Throwable {
    int authManagersSize = authorizationsManagers.size();
    if (authManagersSize == 1) {
        ff4j.setAuthorizationsManager(authorizationsManagers.get(0));
    } else {//from   w w w.j  a va2  s.c o m
        throw new AssertionError("there should and can be only one AuthorizationManager");
    }
}

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

@Bean
@Enabled("${test.DisabledEvaluatedBean.enabled}")
String disabledEvaluatedBean() {// w w  w.j  a  v a2 s . c o m

    throw new AssertionError("disabledEvaluatedBean must not be instantiated.");
}

From source file:de.unentscheidbar.csv2.CaseInsensitiveBenchmark.java

private void run(ColumnNamingData data) {

    for (String key : data.keys.get(data.rnd.nextInt(data.keys.size()))) {
        if (data.cols.getIndex(key) == null)
            throw new AssertionError(key);
    }/*from  ww w  .j  av  a2s. co  m*/
    if (data.cols.getIndex(invalidKey) != null)
        throw new AssertionError();
}

From source file:es.bsc.demiurge.ws.rest.DemiurgeRestV1.java

public DemiurgeRestV1() {
    vmManager = Config.INSTANCE.getVmManager();
    if (vmManager == null)
        throw new AssertionError("VM Manager must not be null");

    vmCallsManager = new VmCallsManager(vmManager);
    imageCallsManager = new ImageCallsManager(vmManager);
    schedAlgCallsManager = new SchedulingAlgorithmCallsManager(vmManager);
    nodeCallsManager = new NodeCallsManager(vmManager);
    logCallsManager = new LogCallsManager();
    estimatesCallsManager = new EstimatesCallsManager();
    vmPlacementCallsManager = new VmPlacementCallsManager(vmManager);
    selfAdaptationCallsManager = new SelfAdaptationCallsManager(vmManager);
}

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

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