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:elaborate.util.PasswordUtil.java

private PasswordUtil() {
    throw new AssertionError("Non-instantiable class");
}

From source file:com.feilong.core.text.MessageFormatUtil.java

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

From source file:com.baidu.qa.service.test.util.MysqlDatabaseManager.java

/**
 * ?mysql db??//  w w w.j  a  va  2 s .c om
 * @param dbname
 * @return
 * @throws SQLException
 */
static public Connection getCon(String dbname) throws SQLException {

    String host = "";
    String user = "";
    String database = "";
    String password = "";
    String driverClass = "";
    String useUnicode = "";
    try {
        // ????
        InputStream in = new BufferedInputStream(
                new FileInputStream(ServiceInterfaceCaseTest.CASEPATH + Constant.FILENAME_DB));

        Properties Info = new Properties();
        Info.load(in);

        host = Info.getProperty(dbname + "_DB_Host");
        user = Info.getProperty(dbname + "_DB_User");
        database = Info.getProperty(dbname + "_DB_DataBase");
        password = Info.getProperty(dbname + "_DB_Password");
        driverClass = Info.getProperty(dbname + "_DB_DriverClass");
        useUnicode = Info.getProperty(dbname + "_DB_UseUnicode");
    } catch (Exception e) {
        log.error("[mysql configure file for" + dbname + "error]:", e);
        throw new AssertionError("[get mysql database config error from properties file]");
    }
    if (host == null) {
        log.error("[load configure file for " + dbname + " error]:");
        return null;
    }

    // 
    String url = "jdbc:mysql://" + host.trim() + "/" + ((database != null) ? database.trim() : "")
            + "?useUnicode=" + ((useUnicode != null) ? useUnicode.trim() : "true&characterEncoding=gbk");

    try {
        Class.forName(driverClass);
    } catch (ClassNotFoundException e) {
        log.error("[class not found]:", e);
        throw new AssertionError("[class not found]");
    }
    Connection con = null;
    try {
        con = DriverManager.getConnection(url, user, password);
    } catch (SQLException a) {
        log.error("[mysql connection exception] ", a);
        throw new AssertionError("[mysql connection exception]");
    }

    return con;

}

From source file:end2endtests.runner.ProcessRunner.java

public ProcessRunner(File workingDir, List<String> command) {
    this.workingDir = workingDir;
    this.command = command;

    try {// w  w w . j  a v a  2  s .c om
        PipedInputStream in = new PipedInputStream();
        toOutputWatcher = new LowLatencyPipedOutputStream(in);
        outputWatcher = new StreamWatcher(new InputStreamReader(in));
    } catch (IOException e) {
        throw new AssertionError(e);
    }
}

From source file:com.github.erchu.beancp.MapperExecutorSelector.java

private MapperExecutorSelector() {
    throw new AssertionError(String.format("Creating an instance of the %s class is not allowed.",
            MapperExecutorSelector.class));
}

From source file:Main.java

/**
 * Return the string representation of the given orientation
 *
 * @param orientation/*w ww .  j  av  a  2  s  . com*/
 * @return
 */
public static String getExifOrientation(int orientation) {
    switch (orientation) {
    case 0:
        return String.valueOf(ExifInterface.ORIENTATION_NORMAL);
    case 90:
        return String.valueOf(ExifInterface.ORIENTATION_ROTATE_90);
    case 180:
        return String.valueOf(ExifInterface.ORIENTATION_ROTATE_180);
    case 270:
        return String.valueOf(ExifInterface.ORIENTATION_ROTATE_270);
    default:
        throw new AssertionError("invalid: " + orientation);
    }
}

From source file:org.jboss.aerogear.windows.mpns.internal.Utilities.java

private Utilities() {
    throw new AssertionError("Uninstantiable class");
}

From source file:com.feilong.commons.core.util.StringBuilderUtil.java

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

From source file:dbs_project.util.TestTableBuilder.java

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

From source file:com.feilong.commons.core.io.SpecialFolder.java

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