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() 

Source Link

Document

Constructs an AssertionError with no detail message.

Usage

From source file:agileinterop.AgileInterop.java

/**
 * @param args the command line arguments
 *//*from w  ww. j  av a2  s .  c  o  m*/
public static void main(String[] args) {
    JSONObject obj;

    try {
        String username, password, agileUrl, operation, body;

        username = args[0];
        password = args[1];
        agileUrl = args[2];
        operation = args[3];
        body = args[4];

        // Connect to Agile
        Agile.connect(username, password, agileUrl);

        switch (operation) {
        case "getPSRData":
            obj = getPSRData(body);
            break;
        case "getPSRList":
            obj = getPSRList(body);
            break;
        case "getPSRCellValues":
            obj = getPSRCellValues(body);
            break;
        case "getRelatedPSRs":
            obj = getRelatedPSRs(body);
            break;
        case "createRelatedPSRs":
            obj = createRelatedPSRs(body);
            break;
        case "writeNewDataToPSRs":
            obj = writeNewDataToPSRs(body);
            break;
        case "attachFileToPSR":
            obj = attachFileToPSR(body);
            break;
        case "crawlAgileByDateOriginated":
            obj = crawlAgileByDateOriginated(body);
            break;
        case "crawlAgileByPSRList":
            obj = crawlAgileByPSRList(body);
            break;
        default:
            throw new AssertionError();
        }

        obj.put("status", "success");

    } catch (APIException | ParseException | InterruptedException ex) {
        obj = new JSONObject();
        obj.put("status", "error");
        obj.put("data", ex.getMessage());
    } catch (Exception ex) {
        obj = new JSONObject();
        obj.put("status", "error");
        obj.put("data", ex.getMessage());
    }

    System.out.print(obj.toJSONString());
}

From source file:Main.java

private synchronized static SSLSocketFactory getDefaultSSLSocketFactory() {
    if (defaultSslSocketFactory == null) {
        try {//w w  w. j  ava  2  s  .c o m
            SSLContext sslContext = SSLContext.getInstance("TLS");
            sslContext.init(null, null, null);
            defaultSslSocketFactory = sslContext.getSocketFactory();
        } catch (GeneralSecurityException e) {
            throw new AssertionError(); // The system has no TLS. Just give
            // up.
        }
    }
    return defaultSslSocketFactory;
}

From source file:Main.java

public static void Assert(boolean cond) {
    if (!cond) {/*from  w w w  .  ja v a  2 s  . com*/
        throw new AssertionError();
    }
}

From source file:Main.java

public static void assertTrue(boolean cond) {
    if (!cond) {/* www.ja  v  a2s. c  o m*/
        throw new AssertionError();
    }
}

From source file:Main.java

/**
 * Convert a IPv4 address from an integer to an InetAddress.
 *
 * @param hostAddress an int corresponding to the IPv4 address in network byte order
 * @return {@link InetAddress}/*from www. j a va 2s.c  om*/
 */
public static InetAddress intToInetAddress(int hostAddress) {
    byte[] addressBytes = { (byte) (0xff & hostAddress), // SUPPRESS
            // CHECKSTYLE
            (byte) (0xff & (hostAddress >> 8)), // SUPPRESS CHECKSTYLE
            (byte) (0xff & (hostAddress >> 16)), // SUPPRESS CHECKSTYLE
            (byte) (0xff & (hostAddress >> 24)) }; // SUPPRESS CHECKSTYLE

    try {
        return InetAddress.getByAddress(addressBytes);
    } catch (UnknownHostException e) {
        throw new AssertionError();
    }
}

From source file:Util.java

public static InputStream toUTF8InputStream(String str) {
    InputStream is = null;/*from w  w w . j ava2 s .  co m*/
    try {
        is = new ByteArrayInputStream(str.getBytes("UTF-8"));
    } catch (UnsupportedEncodingException e) {
        // UTF-8 should always be supported
        throw new AssertionError();
    }
    return is;
}

From source file:de.mpc.pia.tools.PIATools.java

/**
 * We don't ever want to instantiate this class
 */
private PIATools() {
    throw new AssertionError();
}

From source file:com.facebook.util.StringUtils.java

private StringUtils() {
    throw new AssertionError();
}

From source file:com.contentful.vault.compiler.SqliteUtils.java

private SqliteUtils() {
    throw new AssertionError();
}

From source file:com.yattatech.dbtc.util.DbUtil.java

private DbUtil() {
    throw new AssertionError();
}