48 lines
1003 B
Java
48 lines
1003 B
Java
|
package ch.epfl.alpano;
|
||
|
|
||
|
import static ch.epfl.alpano.Preconditions.*;
|
||
|
|
||
|
import org.junit.Test;
|
||
|
|
||
|
public class PreconditionsTest {
|
||
|
////////// checkArgument (1 argument)
|
||
|
|
||
|
@Test
|
||
|
public void checkArgument1SucceedsForTrue() {
|
||
|
checkArgument(true);
|
||
|
}
|
||
|
|
||
|
@Test(expected = IllegalArgumentException.class)
|
||
|
public void checkArgument1ThrowsForFalse() {
|
||
|
checkArgument(false);
|
||
|
}
|
||
|
|
||
|
////////// checkArgument (2 arguments)
|
||
|
|
||
|
@Test
|
||
|
public void checkArgument2SucceedsForTrue() {
|
||
|
checkArgument(true, "");
|
||
|
}
|
||
|
|
||
|
@Test(expected = IllegalArgumentException.class)
|
||
|
public void checkArgument2ThrowsForFalse() {
|
||
|
checkArgument(false, "");
|
||
|
}
|
||
|
|
||
|
////////// checkNonNul (1 arguments)
|
||
|
|
||
|
@Test
|
||
|
public void checkNonNulSuccess() {
|
||
|
checkNonNul(1, "");
|
||
|
}
|
||
|
|
||
|
@Test(expected = NullPointerException.class)
|
||
|
public void checkNonNulThrowsForZero() {
|
||
|
checkNonNul(0, "");
|
||
|
}
|
||
|
|
||
|
////////// checkNonNul (1 arguments)
|
||
|
|
||
|
|
||
|
}
|