protected void isTrue( String message, boolean value) { if (!value) { throw new TestFailedException(SimpleTestResult.failed(this, message)); } }
public static TestResult successful( Test test, String message) { return new SimpleTestResult(true, test.getName() + ": " + message); }
/** * Constructor based on a byte array. * * @param encoding a 2's complement representation of the BigInteger. */ public TestRandomBigInteger(byte[] encoding) { super(new FixedSecureRandom.Source[] { new FixedSecureRandom.BigInteger(encoding) }); }
private static Data[] buildDataArray(byte[][] values) { Data[] res = new Data[values.length]; for (int i = 0; i != values.length; i++) { res[i] = new Data(values[i]); } return res; }
public FixedSecureRandom( byte[][] values) { this(buildDataArray(values)); }
public byte[] generateSeed(int numBytes) { byte[] bytes = new byte[numBytes]; this.nextBytes(bytes); return bytes; }
protected void isEquals( String message, long a, long b) { if (a != b) { throw new TestFailedException(SimpleTestResult.failed(this, message)); } }
public static TestResult failed( Test test, String message, Throwable t) { return new SimpleTestResult(false, test.getName() + ": " + message, t); }
/** * Constructor from an array of bytes. * * @param encoding a byte array representing the data to be returned. */ public TestRandomData(byte[] encoding) { super(new Source[] { new FixedSecureRandom.Data(encoding) }); } }
protected void fail( String message) { throw new TestFailedException(SimpleTestResult.failed(this, message)); }
public static TestResult successful( Test test, String message) { return new SimpleTestResult(true, test.getName() + ": " + message); }
protected void isTrue( boolean value) { if (!value) { throw new TestFailedException(SimpleTestResult.failed(this, "no message")); } }
public static TestResult failed( Test test, String message, Throwable t) { return new SimpleTestResult(false, test.getName() + ": " + message, t); }
protected void isEquals( int a, int b) { if (a != b) { throw new TestFailedException(SimpleTestResult.failed(this, "no message")); } }
protected void isEquals( long a, long b) { if (a != b) { throw new TestFailedException(SimpleTestResult.failed(this, "no message")); } }
protected void isEquals( String message, boolean a, boolean b) { if (a != b) { throw new TestFailedException(SimpleTestResult.failed(this, message)); } }
protected void fail( String message, Throwable throwable) { throw new TestFailedException(SimpleTestResult.failed(this, message, throwable)); }
protected void fail( String message, Object expected, Object found) { throw new TestFailedException(SimpleTestResult.failed(this, message, expected, found)); }
protected void fail( String message, Object expected, Object found) { throw new TestFailedException(SimpleTestResult.failed(this, message, expected, found)); }