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.sunchenbin.store.feilong.core.text.DateFormatUtil.java

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

From source file:edu.emory.bmi.aiw.i2b2export.output.PatientDataOutputFormatter.java

public void format(BufferedWriter writer) throws IOException {
    try {/*from  ww w  . j a v  a 2 s  .  c  o  m*/
        Class.forName("org.h2.Driver");
    } catch (ClassNotFoundException ex) {
        throw new AssertionError("Error parsing i2b2 metadata: " + ex);
    }
    try (Connection con = DriverManager.getConnection("jdbc:h2:mem:PatientDataOutputFormatter")) {
        for (Patient patient : this.patients) {
            new PatientDataRowOutputFormatter(getOutputConfiguration(), patient, con).format(writer);
            writer.write(IOUtils.LINE_SEPARATOR);
        }
    } catch (SQLException ex) {
        throw new IOException("Error parsing i2b2 metadata: " + ex.getMessage());
    }
}

From source file:edu.emory.bmi.aiw.i2b2export.output.VisitDataOutputFormatter.java

public void format(BufferedWriter writer) throws IOException {
    try {/* w w w  . ja  va  2s  .  c  o m*/
        Class.forName("org.h2.Driver");
    } catch (ClassNotFoundException ex) {
        throw new AssertionError("Error parsing i2b2 metadata: " + ex);
    }
    try (Connection con = DriverManager.getConnection("jdbc:h2:mem:VisitDataOutputFormatter")) {
        for (Patient patient : this.patients) {
            for (Event visit : patient.getEvents()) {
                new VisitDataRowOutputFormatter(this.config, visit, con).format(writer);
                writer.write(IOUtils.LINE_SEPARATOR);
            }
        }
    } catch (SQLException ex) {
        throw new IOException("Error parsing i2b2 metadata: " + ex.getMessage());
    }
}

From source file:com.nearinfinity.honeycomb.hbase.bulkload.FieldParser.java

private FieldParser() {
    throw new AssertionError("This should not be constructed.");
}

From source file:com.flipkart.phantom.http.impl.HttpProxy.java

/**
 *  Init hook provided by the HttpProxy//from w  w w  . ja va  2s . co m
 */
public void init(TaskContext context) throws Exception {
    if (pool == null) {
        throw new AssertionError("HttpConnectionPool object 'pool' must be given");
    } else {
        pool.initConnectionPool();
    }
}

From source file:com.zxy.commons.lang.conf.AbstractConfigProperties.java

protected AbstractConfigProperties() {
    try {/*from   ww  w .j  a v  a 2s.c  o  m*/
        properties = load();
    } catch (IOException e) {
        throw new AssertionError(e);
    }
}

From source file:com.predic8.membrane.test.AssertUtils.java

public static void assertContains(String needle, String haystack) {
    if (haystack.contains(needle))
        return;//from  w  w w.ja  v a 2 s . c om
    throw new AssertionError("The string '" + haystack + "' does not contain '" + needle + "'.");
}

From source file:com.feilong.taglib.display.option.OptionBuilder.java

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

From source file:com.elytradev.thermionics.data.RelativeDirection.java

@Nullable
public static RelativeDirection of(@Nonnull EnumFacing deviceFacing, @Nullable EnumFacing side) {
    if (side == null)
        return WITHIN; //valid configuration
    Validate.notNull(deviceFacing);/*from w ww. j a  v a 2 s. c  o m*/

    if (deviceFacing == side)
        return BOW;
    if (deviceFacing == side.getOpposite())
        return STERN;

    //when facing up and down, the block has a preferred, unchangeable Y rotation
    if (deviceFacing == EnumFacing.UP) {
        switch (side) {
        case NORTH:
            return TOP;
        case EAST:
            return PORT;
        case SOUTH:
            return BOTTOM;
        case WEST:
            return STARBOARD;
        default:
            throw new AssertionError("Unreachable code reached (side=" + side.getName() + " deviceFacing="
                    + deviceFacing.getName() + ")");
        }
    }

    if (deviceFacing == EnumFacing.DOWN) {
        switch (side) {
        case NORTH:
            return BOTTOM;
        case EAST:
            return PORT;
        case SOUTH:
            return TOP;
        case WEST:
            return STARBOARD;
        default:
            throw new AssertionError("Unreachable code reached.");
        }
    }

    //From here on we're dealing with planar rotations

    if (side == EnumFacing.DOWN)
        return BOTTOM;
    if (side == EnumFacing.UP)
        return TOP;
    if (side == deviceFacing.rotateY())
        return STARBOARD;
    if (side == deviceFacing.rotateYCCW())
        return PORT;

    throw new AssertionError("Unreachable code reached (side=" + side.getName() + " deviceFacing="
            + deviceFacing.getName() + ")");
}

From source file:com.hurence.logisland.utils.HttpUtils.java

public static List<String> getQueryValues(String urlQuery) {
    try {/*w w  w.j a v a2s . c om*/
        List<String> values = new ArrayList<>();
        if (urlQuery == null) {
            return values;
        }

        for (String param : urlQuery.split("&")) {
            QueryParam queryParam = new QueryParam();
            String[] pair = param.split("=");
            String value = "";
            if (pair.length > 1) {
                value = URLDecoder.decode(pair[1], "UTF-8");
            }
            if (value != null && !value.equals("null")) {
                values.add(value);
            }
        }
        return values;
    } catch (UnsupportedEncodingException ex) {
        throw new AssertionError(ex);
    }
}