![JAR search and dependency download from the Maven repository](/logo.png)
org.jcodec.common.Assert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jcodec Show documentation
Show all versions of jcodec Show documentation
Pure Java implementation of video/audio codecs and formats
package org.jcodec.common;
/**
* This class is part of JCodec ( www.jcodec.org ) This software is distributed
* under FreeBSD License
*
* @author The JCodec project
*
*/
public class Assert {
public static void assertTrue(boolean b) {
if (!b)
throw new AssertionError();
}
public static void assertTrue(String msg, boolean b) {
if (!b)
throw new AssertionError(msg);
}
public static void assertEquals(String msg, int i, int j) {
if (i != j)
throw new AssertionError(msg + " expected " + i + " actual " + j);
}
public static void assertEquals(String i, String j) {
if (i != j)
throw new AssertionError("Expected " + i + " actual " + j);
}
public static void assertEquals(int i, int j) {
if (i != j)
throw new AssertionError();
}
public static void assertEquals(long i, long j) {
if (i != j)
throw new AssertionError();
}
public static void assertNotNull(Object obj) {
if (obj == null)
throw new AssertionError();
}
public static void assertArrayEquals(int[] a, int[] b) {
if (a == b)
return;
if (a == null || b == null)
throw new AssertionError();
if (a.length != b.length)
throw new AssertionError();
for (int i = 0; i < a.length; i++)
if (a[i] != b[i])
throw new AssertionError();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy