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