mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Use fail() instead of assertTrue(false).
This commit is contained in:
@@ -34,7 +34,7 @@ public class DatabaseCleanerImplTest extends TestCase {
|
||||
try {
|
||||
assertTrue(latch.await(5, TimeUnit.SECONDS));
|
||||
} catch(InterruptedException e) {
|
||||
assertTrue(false);
|
||||
fail();
|
||||
}
|
||||
// Stop the cleaner (it should be waiting between sweeps)
|
||||
cleaner.stopCleaning();
|
||||
|
||||
@@ -470,63 +470,63 @@ public abstract class DatabaseComponentTest extends TestCase {
|
||||
|
||||
try {
|
||||
db.generateAck(contactId, ackWriter);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(NoSuchContactException expected) {}
|
||||
|
||||
try {
|
||||
db.generateBatch(contactId, batchWriter);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(NoSuchContactException expected) {}
|
||||
|
||||
try {
|
||||
db.generateBatch(contactId, batchWriter,
|
||||
Collections.<MessageId>emptyList());
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(NoSuchContactException expected) {}
|
||||
|
||||
try {
|
||||
db.generateOffer(contactId, offerWriter);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(NoSuchContactException expected) {}
|
||||
|
||||
try {
|
||||
db.generateSubscriptions(contactId, subscriptionWriter);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(NoSuchContactException expected) {}
|
||||
|
||||
try {
|
||||
db.generateTransports(contactId, transportWriter);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(NoSuchContactException expected) {}
|
||||
|
||||
try {
|
||||
db.hasSendableMessages(contactId);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(NoSuchContactException expected) {}
|
||||
|
||||
try {
|
||||
db.receiveAck(contactId, ack);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(NoSuchContactException expected) {}
|
||||
|
||||
try {
|
||||
db.receiveBatch(contactId, batch);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(NoSuchContactException expected) {}
|
||||
|
||||
try {
|
||||
db.receiveOffer(contactId, offer, requestWriter);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(NoSuchContactException expected) {}
|
||||
|
||||
try {
|
||||
db.receiveSubscriptions(contactId, subscriptionsUpdate);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(NoSuchContactException expected) {}
|
||||
|
||||
try {
|
||||
db.receiveTransports(contactId, transportsUpdate);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(NoSuchContactException expected) {}
|
||||
|
||||
context.assertIsSatisfied();
|
||||
|
||||
@@ -1119,7 +1119,7 @@ public class H2DatabaseTest extends TestCase {
|
||||
try {
|
||||
// Ask for a nonexistent message - an exception should be thrown
|
||||
db.getMessage(txn, messageId);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(DbException expected) {
|
||||
// It should be possible to abort the transaction without error
|
||||
db.abortTransaction(txn);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class AckReaderTest extends TestCase {
|
||||
|
||||
try {
|
||||
reader.readUserDefined(Tags.ACK, Ack.class);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(FormatException expected) {}
|
||||
context.assertIsSatisfied();
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class BatchReaderTest extends TestCase {
|
||||
|
||||
try {
|
||||
reader.readUserDefined(Tags.BATCH, Batch.class);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(FormatException expected) {}
|
||||
context.assertIsSatisfied();
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class ConsumersTest extends TestCase {
|
||||
assertEquals(data.length, cc.getCount());
|
||||
try {
|
||||
cc.write((byte) 0);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(FormatException expected) {}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public class RequestReaderTest extends TestCase {
|
||||
|
||||
try {
|
||||
reader.readUserDefined(Tags.REQUEST, Request.class);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(FormatException expected) {}
|
||||
context.assertIsSatisfied();
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ public class SigningDigestingOutputStreamTest extends TestCase {
|
||||
s.setSigning(true); // Signature hasn't been initialised yet
|
||||
try {
|
||||
s.write((byte) 0);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(IOException expected) {};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public class ReaderImplTest extends TestCase {
|
||||
assertEquals("foo", r.readString(3));
|
||||
try {
|
||||
r.readString(2);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(FormatException expected) {}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public class ReaderImplTest extends TestCase {
|
||||
assertTrue(Arrays.equals(new byte[] {1, 2, 3}, r.readBytes(3)));
|
||||
try {
|
||||
r.readBytes(2);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(FormatException expected) {}
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ public class ReaderImplTest extends TestCase {
|
||||
// FormatException
|
||||
try {
|
||||
r.readList(Byte.class);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(FormatException expected) {}
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ public class ReaderImplTest extends TestCase {
|
||||
// No object reader has been added for tag 0
|
||||
try {
|
||||
r.readUserDefined(0, Foo.class);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(FormatException expected) {}
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ public class ReaderImplTest extends TestCase {
|
||||
// Trying to read the object as class Bar should throw a FormatException
|
||||
try {
|
||||
r.readUserDefined(0, Bar.class);
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(FormatException expected) {}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,11 +31,11 @@ public class StringUtilsTest extends TestCase {
|
||||
public void testFromHexString() {
|
||||
try {
|
||||
StringUtils.fromHexString("12345");
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(IllegalArgumentException expected) {}
|
||||
try {
|
||||
StringUtils.fromHexString("ABCDEFGH");
|
||||
assertTrue(false);
|
||||
fail();
|
||||
} catch(IllegalArgumentException expected) {}
|
||||
byte[] b = StringUtils.fromHexString("0102037F80");
|
||||
assertTrue(Arrays.equals(new byte[] {1, 2, 3, 127, -128}, b));
|
||||
|
||||
Reference in New Issue
Block a user