mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
Diamond operators.
This commit is contained in:
@@ -24,7 +24,7 @@ public class PoliteExecutorTest extends BrambleTestCase {
|
||||
Executor delegate = Executors.newSingleThreadExecutor();
|
||||
// Allow all the tasks to be delegated straight away
|
||||
PoliteExecutor polite = new PoliteExecutor(TAG, delegate, TASKS * 2);
|
||||
final List<Integer> list = new Vector<Integer>();
|
||||
final List<Integer> list = new Vector<>();
|
||||
final CountDownLatch latch = new CountDownLatch(TASKS);
|
||||
for (int i = 0; i < TASKS; i++) {
|
||||
final int result = i;
|
||||
@@ -49,7 +49,7 @@ public class PoliteExecutorTest extends BrambleTestCase {
|
||||
Executor delegate = Executors.newSingleThreadExecutor();
|
||||
// Allow two tasks to be delegated at a time
|
||||
PoliteExecutor polite = new PoliteExecutor(TAG, delegate, 2);
|
||||
final List<Integer> list = new Vector<Integer>();
|
||||
final List<Integer> list = new Vector<>();
|
||||
final CountDownLatch latch = new CountDownLatch(TASKS);
|
||||
for (int i = 0; i < TASKS; i++) {
|
||||
final int result = i;
|
||||
@@ -73,7 +73,7 @@ public class PoliteExecutorTest extends BrambleTestCase {
|
||||
Executor delegate = Executors.newCachedThreadPool();
|
||||
// Allow all the tasks to be delegated straight away
|
||||
PoliteExecutor polite = new PoliteExecutor(TAG, delegate, TASKS * 2);
|
||||
final List<Integer> list = new Vector<Integer>();
|
||||
final List<Integer> list = new Vector<>();
|
||||
final CountDownLatch[] latches = new CountDownLatch[TASKS];
|
||||
for (int i = 0; i < TASKS; i++) latches[i] = new CountDownLatch(1);
|
||||
for (int i = 0; i < TASKS; i++) {
|
||||
@@ -104,7 +104,7 @@ public class PoliteExecutorTest extends BrambleTestCase {
|
||||
Executor delegate = Executors.newCachedThreadPool();
|
||||
// Allow one task to be delegated at a time
|
||||
PoliteExecutor polite = new PoliteExecutor(TAG, delegate, 1);
|
||||
final List<Integer> list = new Vector<Integer>();
|
||||
final List<Integer> list = new Vector<>();
|
||||
final CountDownLatch latch = new CountDownLatch(TASKS);
|
||||
for (int i = 0; i < TASKS; i++) {
|
||||
final int result = i;
|
||||
|
||||
@@ -165,8 +165,7 @@ public class ClientHelperImplTest extends BrambleTestCase {
|
||||
|
||||
@Test
|
||||
public void testGetMessageMetadataAsDictionaryMap() throws Exception {
|
||||
final Map<MessageId, BdfDictionary> map =
|
||||
new HashMap<MessageId, BdfDictionary>();
|
||||
final Map<MessageId, BdfDictionary> map = new HashMap<>();
|
||||
map.put(messageId, dictionary);
|
||||
final Transaction txn = new Transaction(null, true);
|
||||
|
||||
@@ -188,8 +187,7 @@ public class ClientHelperImplTest extends BrambleTestCase {
|
||||
|
||||
@Test
|
||||
public void testGetMessageMetadataAsDictionaryQuery() throws Exception {
|
||||
final Map<MessageId, BdfDictionary> map =
|
||||
new HashMap<MessageId, BdfDictionary>();
|
||||
final Map<MessageId, BdfDictionary> map = new HashMap<>();
|
||||
map.put(messageId, dictionary);
|
||||
final BdfDictionary query =
|
||||
BdfDictionary.of(new BdfEntry("query", "me"));
|
||||
|
||||
@@ -132,8 +132,7 @@ public class ContactManagerImplTest extends BrambleMockTestCase {
|
||||
@Test
|
||||
public void testActiveContacts() throws Exception {
|
||||
Collection<Contact> activeContacts = Collections.singletonList(contact);
|
||||
final Collection<Contact> contacts =
|
||||
new ArrayList<Contact>(activeContacts);
|
||||
final Collection<Contact> contacts = new ArrayList<>(activeContacts);
|
||||
contacts.add(new Contact(new ContactId(3), remote, local, true, false));
|
||||
final Transaction txn = new Transaction(null, true);
|
||||
context.checking(new Expectations() {{
|
||||
|
||||
@@ -69,7 +69,7 @@ public class EllipticCurvePerformanceTest {
|
||||
ECPublicKeyParameters public2 =
|
||||
(ECPublicKeyParameters) keyPair2.getPublic();
|
||||
// Time some ECDH key agreements
|
||||
List<Long> samples = new ArrayList<Long>();
|
||||
List<Long> samples = new ArrayList<>();
|
||||
for (int i = 0; i < SAMPLES; i++) {
|
||||
ECDHCBasicAgreement agreement = new ECDHCBasicAgreement();
|
||||
long start = System.nanoTime();
|
||||
@@ -79,7 +79,7 @@ public class EllipticCurvePerformanceTest {
|
||||
}
|
||||
long agreementMedian = median(samples);
|
||||
// Time some signatures
|
||||
List<byte[]> signatures = new ArrayList<byte[]>();
|
||||
List<byte[]> signatures = new ArrayList<>();
|
||||
samples.clear();
|
||||
for (int i = 0; i < SAMPLES; i++) {
|
||||
Digest digest = new Blake2sDigest();
|
||||
|
||||
@@ -145,7 +145,7 @@ public class KeyDerivationTest extends BrambleTestCase {
|
||||
}
|
||||
|
||||
private void assertAllDifferent(TransportKeys... transportKeys) {
|
||||
List<SecretKey> secretKeys = new ArrayList<SecretKey>();
|
||||
List<SecretKey> secretKeys = new ArrayList<>();
|
||||
for (TransportKeys k : transportKeys) {
|
||||
secretKeys.add(k.getPreviousIncomingKeys().getTagKey());
|
||||
secretKeys.add(k.getPreviousIncomingKeys().getHeaderKey());
|
||||
@@ -160,7 +160,7 @@ public class KeyDerivationTest extends BrambleTestCase {
|
||||
}
|
||||
|
||||
private void assertAllDifferent(List<SecretKey> keys) {
|
||||
Set<Bytes> set = new HashSet<Bytes>();
|
||||
Set<Bytes> set = new HashSet<>();
|
||||
for (SecretKey k : keys) assertTrue(set.add(new Bytes(k.getBytes())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class TagEncodingTest extends BrambleTestCase {
|
||||
|
||||
@Test
|
||||
public void testKeyAffectsTag() throws Exception {
|
||||
Set<Bytes> set = new HashSet<Bytes>();
|
||||
Set<Bytes> set = new HashSet<>();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
byte[] tag = new byte[TAG_LENGTH];
|
||||
SecretKey tagKey = TestUtils.getSecretKey();
|
||||
@@ -39,7 +39,7 @@ public class TagEncodingTest extends BrambleTestCase {
|
||||
|
||||
@Test
|
||||
public void testProtocolVersionAffectsTag() throws Exception {
|
||||
Set<Bytes> set = new HashSet<Bytes>();
|
||||
Set<Bytes> set = new HashSet<>();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
byte[] tag = new byte[TAG_LENGTH];
|
||||
crypto.encodeTag(tag, tagKey, PROTOCOL_VERSION + i, streamNumber);
|
||||
@@ -49,7 +49,7 @@ public class TagEncodingTest extends BrambleTestCase {
|
||||
|
||||
@Test
|
||||
public void testStreamNumberAffectsTag() throws Exception {
|
||||
Set<Bytes> set = new HashSet<Bytes>();
|
||||
Set<Bytes> set = new HashSet<>();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
byte[] tag = new byte[TAG_LENGTH];
|
||||
crypto.encodeTag(tag, tagKey, PROTOCOL_VERSION, streamNumber + i);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package org.briarproject.bramble.data;
|
||||
|
||||
import org.briarproject.bramble.test.BrambleTestCase;
|
||||
import org.briarproject.bramble.test.TestUtils;
|
||||
import org.briarproject.bramble.util.StringUtils;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -155,7 +154,7 @@ public class BdfWriterImplTest extends BrambleTestCase {
|
||||
|
||||
@Test
|
||||
public void testWriteList() throws IOException {
|
||||
List<Object> l = new ArrayList<Object>();
|
||||
List<Object> l = new ArrayList<>();
|
||||
for (int i = 0; i < 3; i++) l.add(i);
|
||||
w.writeList(l);
|
||||
// LIST tag, elements as integers, END tag
|
||||
@@ -164,7 +163,7 @@ public class BdfWriterImplTest extends BrambleTestCase {
|
||||
|
||||
@Test
|
||||
public void testListCanContainNull() throws IOException {
|
||||
List<Object> l = new ArrayList<Object>();
|
||||
List<Object> l = new ArrayList<>();
|
||||
l.add(1);
|
||||
l.add(null);
|
||||
l.add(NULL_VALUE);
|
||||
@@ -177,7 +176,7 @@ public class BdfWriterImplTest extends BrambleTestCase {
|
||||
@Test
|
||||
public void testWriteDictionary() throws IOException {
|
||||
// Use LinkedHashMap to get predictable iteration order
|
||||
Map<String, Object> m = new LinkedHashMap<String, Object>();
|
||||
Map<String, Object> m = new LinkedHashMap<>();
|
||||
for (int i = 0; i < 4; i++) m.put(String.valueOf(i), i);
|
||||
w.writeDictionary(m);
|
||||
// DICTIONARY tag, keys as strings and values as integers, END tag
|
||||
@@ -216,12 +215,12 @@ public class BdfWriterImplTest extends BrambleTestCase {
|
||||
|
||||
@Test
|
||||
public void testWriteNestedDictionariesAndLists() throws IOException {
|
||||
Map<String, Object> inner = new LinkedHashMap<String, Object>();
|
||||
Map<String, Object> inner = new LinkedHashMap<>();
|
||||
inner.put("bar", new byte[0]);
|
||||
List<Object> list = new ArrayList<Object>();
|
||||
List<Object> list = new ArrayList<>();
|
||||
list.add(1);
|
||||
list.add(inner);
|
||||
Map<String, Object> outer = new LinkedHashMap<String, Object>();
|
||||
Map<String, Object> outer = new LinkedHashMap<>();
|
||||
outer.put("foo", list);
|
||||
w.writeDictionary(outer);
|
||||
// DICTIONARY tag, "foo" as string, LIST tag, 1 as integer,
|
||||
|
||||
@@ -99,7 +99,7 @@ public class MetadataEncoderParserIntegrationTest extends BrambleTestCase {
|
||||
|
||||
@Test
|
||||
public void testList() throws FormatException {
|
||||
List<Long> l = new ArrayList<Long>(4);
|
||||
List<Long> l = new ArrayList<>(4);
|
||||
l.add(42L);
|
||||
l.add(1337L);
|
||||
l.add(Long.MIN_VALUE);
|
||||
@@ -114,7 +114,7 @@ public class MetadataEncoderParserIntegrationTest extends BrambleTestCase {
|
||||
|
||||
@Test
|
||||
public void testDictionary() throws FormatException {
|
||||
Map<String, Boolean> m = new HashMap<String, Boolean>();
|
||||
Map<String, Boolean> m = new HashMap<>();
|
||||
m.put("1", true);
|
||||
m.put("2", false);
|
||||
|
||||
@@ -130,19 +130,19 @@ public class MetadataEncoderParserIntegrationTest extends BrambleTestCase {
|
||||
|
||||
@Test
|
||||
public void testComplexDictionary() throws FormatException {
|
||||
Map<String, List> m = new HashMap<String, List>();
|
||||
List<String> one = new ArrayList<String>(3);
|
||||
Map<String, List> m = new HashMap<>();
|
||||
List<String> one = new ArrayList<>(3);
|
||||
one.add("\uFDD0");
|
||||
one.add("\uFDD1");
|
||||
one.add("\uFDD2");
|
||||
m.put("One", one);
|
||||
List<String> two = new ArrayList<String>(2);
|
||||
List<String> two = new ArrayList<>(2);
|
||||
two.add("\u0080");
|
||||
two.add("\uD800\uDC00");
|
||||
m.put("Two", two);
|
||||
d.put("test", m);
|
||||
|
||||
Map<String, Boolean> m2 = new HashMap<String, Boolean>();
|
||||
Map<String, Boolean> m2 = new HashMap<>();
|
||||
m2.put("should be true", true);
|
||||
d.put("another test", m2);
|
||||
|
||||
|
||||
@@ -323,7 +323,7 @@ public class BasicH2Test extends BrambleTestCase {
|
||||
|
||||
private List<String> getNames() throws SQLException {
|
||||
String sql = "SELECT name FROM foo ORDER BY uniqueId";
|
||||
List<String> names = new ArrayList<String>();
|
||||
List<String> names = new ArrayList<>();
|
||||
try {
|
||||
PreparedStatement ps = connection.prepareStatement(sql);
|
||||
ResultSet rs = ps.executeQuery();
|
||||
|
||||
@@ -120,8 +120,8 @@ public class DatabaseComponentImplTest extends BrambleTestCase {
|
||||
|
||||
private DatabaseComponent createDatabaseComponent(Database<Object> database,
|
||||
EventBus eventBus, ShutdownManager shutdown) {
|
||||
return new DatabaseComponentImpl<Object>(database, Object.class,
|
||||
eventBus, shutdown);
|
||||
return new DatabaseComponentImpl<>(database, Object.class, eventBus,
|
||||
shutdown);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -1703,7 +1703,7 @@ public class DatabaseComponentImplTest extends BrambleTestCase {
|
||||
Transaction transaction = db.startTransaction(false);
|
||||
try {
|
||||
db.addLocalMessage(transaction, message, metadata, true);
|
||||
Collection<MessageId> dependencies = new ArrayList<MessageId>(2);
|
||||
Collection<MessageId> dependencies = new ArrayList<>(2);
|
||||
dependencies.add(messageId1);
|
||||
dependencies.add(messageId2);
|
||||
db.addMessageDependencies(transaction, message, dependencies);
|
||||
|
||||
@@ -870,7 +870,7 @@ public class H2DatabaseTest extends BrambleTestCase {
|
||||
assertEquals(0, db.countOfferedMessages(txn, contactId));
|
||||
|
||||
// Add some offered messages and count them
|
||||
List<MessageId> ids = new ArrayList<MessageId>();
|
||||
List<MessageId> ids = new ArrayList<>();
|
||||
for (int i = 0; i < 10; i++) {
|
||||
MessageId m = new MessageId(TestUtils.getRandomId());
|
||||
db.addOfferedMessage(txn, contactId, m);
|
||||
|
||||
@@ -81,7 +81,7 @@ public class IdentityManagerImplTest extends BrambleMockTestCase {
|
||||
@Test
|
||||
public void testGetAuthorStatus() throws DbException {
|
||||
final AuthorId authorId = new AuthorId(TestUtils.getRandomId());
|
||||
final Collection<Contact> contacts = new ArrayList<Contact>();
|
||||
final Collection<Contact> contacts = new ArrayList<>();
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
oneOf(db).startTransaction(true);
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ShutdownManagerImplTest extends BrambleTestCase {
|
||||
@Test
|
||||
public void testAddAndRemove() {
|
||||
ShutdownManager s = createShutdownManager();
|
||||
Set<Integer> handles = new HashSet<Integer>();
|
||||
Set<Integer> handles = new HashSet<>();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
int handle = s.addShutdownHook(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -194,8 +194,7 @@ public class LanTcpPluginTest extends BrambleTestCase {
|
||||
plugin.createKeyAgreementListener(new byte[COMMIT_LENGTH]);
|
||||
assertNotNull(kal);
|
||||
Callable<KeyAgreementConnection> c = kal.listen();
|
||||
FutureTask<KeyAgreementConnection> f =
|
||||
new FutureTask<KeyAgreementConnection>(c);
|
||||
FutureTask<KeyAgreementConnection> f = new FutureTask<>(c);
|
||||
new Thread(f).start();
|
||||
// The plugin should have bound a socket and stored the port number
|
||||
BdfList descriptor = kal.getDescriptor();
|
||||
@@ -291,7 +290,7 @@ public class LanTcpPluginTest extends BrambleTestCase {
|
||||
private static class Callback implements DuplexPluginCallback {
|
||||
|
||||
private final Map<ContactId, TransportProperties> remote =
|
||||
new Hashtable<ContactId, TransportProperties>();
|
||||
new Hashtable<>();
|
||||
private final CountDownLatch propertiesLatch = new CountDownLatch(1);
|
||||
private final CountDownLatch connectionsLatch = new CountDownLatch(1);
|
||||
private final TransportProperties local = new TransportProperties();
|
||||
|
||||
@@ -179,7 +179,7 @@ public class TransportPropertyManagerImplTest extends BrambleMockTestCase {
|
||||
new BdfEntry("local", false)
|
||||
);
|
||||
final Map<MessageId, BdfDictionary> messageMetadata =
|
||||
new LinkedHashMap<MessageId, BdfDictionary>();
|
||||
new LinkedHashMap<>();
|
||||
// A remote update for another transport should be ignored
|
||||
MessageId barUpdateId = new MessageId(getRandomId());
|
||||
messageMetadata.put(barUpdateId, BdfDictionary.of(
|
||||
@@ -221,7 +221,7 @@ public class TransportPropertyManagerImplTest extends BrambleMockTestCase {
|
||||
new BdfEntry("local", false)
|
||||
);
|
||||
final Map<MessageId, BdfDictionary> messageMetadata =
|
||||
new LinkedHashMap<MessageId, BdfDictionary>();
|
||||
new LinkedHashMap<>();
|
||||
// Old remote updates for the same transport should be deleted
|
||||
final MessageId fooVersion2 = new MessageId(getRandomId());
|
||||
messageMetadata.put(fooVersion2, BdfDictionary.of(
|
||||
@@ -274,7 +274,7 @@ public class TransportPropertyManagerImplTest extends BrambleMockTestCase {
|
||||
new BdfEntry("local", false)
|
||||
);
|
||||
final Map<MessageId, BdfDictionary> messageMetadata =
|
||||
new LinkedHashMap<MessageId, BdfDictionary>();
|
||||
new LinkedHashMap<>();
|
||||
// Old remote updates for the same transport should be deleted
|
||||
final MessageId fooVersion2 = new MessageId(getRandomId());
|
||||
messageMetadata.put(fooVersion2, BdfDictionary.of(
|
||||
@@ -322,7 +322,7 @@ public class TransportPropertyManagerImplTest extends BrambleMockTestCase {
|
||||
final Group contactGroup = getGroup();
|
||||
final Transaction txn = new Transaction(null, false);
|
||||
Map<TransportId, TransportProperties> properties =
|
||||
new LinkedHashMap<TransportId, TransportProperties>();
|
||||
new LinkedHashMap<>();
|
||||
properties.put(new TransportId("foo"), fooProperties);
|
||||
properties.put(new TransportId("bar"), barProperties);
|
||||
|
||||
@@ -359,7 +359,7 @@ public class TransportPropertyManagerImplTest extends BrambleMockTestCase {
|
||||
throws Exception {
|
||||
final Transaction txn = new Transaction(null, false);
|
||||
final Map<MessageId, BdfDictionary> messageMetadata =
|
||||
new LinkedHashMap<MessageId, BdfDictionary>();
|
||||
new LinkedHashMap<>();
|
||||
// A local update for another transport should be ignored
|
||||
MessageId barUpdateId = new MessageId(getRandomId());
|
||||
messageMetadata.put(barUpdateId, BdfDictionary.of(
|
||||
@@ -386,7 +386,7 @@ public class TransportPropertyManagerImplTest extends BrambleMockTestCase {
|
||||
public void testReturnsLocalProperties() throws Exception {
|
||||
final Transaction txn = new Transaction(null, false);
|
||||
final Map<MessageId, BdfDictionary> messageMetadata =
|
||||
new LinkedHashMap<MessageId, BdfDictionary>();
|
||||
new LinkedHashMap<>();
|
||||
// A local update for another transport should be ignored
|
||||
MessageId barUpdateId = new MessageId(getRandomId());
|
||||
messageMetadata.put(barUpdateId, BdfDictionary.of(
|
||||
@@ -432,7 +432,7 @@ public class TransportPropertyManagerImplTest extends BrambleMockTestCase {
|
||||
final Group contactGroup2 = getGroup();
|
||||
final Group contactGroup3 = getGroup();
|
||||
final Map<MessageId, BdfDictionary> messageMetadata3 =
|
||||
new LinkedHashMap<MessageId, BdfDictionary>();
|
||||
new LinkedHashMap<>();
|
||||
// A remote update for another transport should be ignored
|
||||
MessageId barUpdateId = new MessageId(getRandomId());
|
||||
messageMetadata3.put(barUpdateId, BdfDictionary.of(
|
||||
@@ -641,7 +641,7 @@ public class TransportPropertyManagerImplTest extends BrambleMockTestCase {
|
||||
private void expectGetLocalProperties(final Transaction txn)
|
||||
throws Exception {
|
||||
final Map<MessageId, BdfDictionary> messageMetadata =
|
||||
new LinkedHashMap<MessageId, BdfDictionary>();
|
||||
new LinkedHashMap<>();
|
||||
// The only update for transport "foo" should be returned
|
||||
final MessageId fooVersion999 = new MessageId(getRandomId());
|
||||
messageMetadata.put(fooVersion999, BdfDictionary.of(
|
||||
|
||||
@@ -718,8 +718,7 @@ public class ValidationManagerImplTest extends BrambleMockTestCase {
|
||||
public void testRecursiveInvalidation() throws Exception {
|
||||
final MessageId messageId3 = new MessageId(TestUtils.getRandomId());
|
||||
final MessageId messageId4 = new MessageId(TestUtils.getRandomId());
|
||||
final Map<MessageId, State> twoDependents =
|
||||
new LinkedHashMap<MessageId, State>();
|
||||
final Map<MessageId, State> twoDependents = new LinkedHashMap<>();
|
||||
twoDependents.put(messageId1, PENDING);
|
||||
twoDependents.put(messageId2, PENDING);
|
||||
final Transaction txn = new Transaction(null, true);
|
||||
@@ -826,12 +825,10 @@ public class ValidationManagerImplTest extends BrambleMockTestCase {
|
||||
raw);
|
||||
final Message message4 = new Message(messageId4, groupId, timestamp,
|
||||
raw);
|
||||
final Map<MessageId, State> twoDependents =
|
||||
new LinkedHashMap<MessageId, State>();
|
||||
final Map<MessageId, State> twoDependents = new LinkedHashMap<>();
|
||||
twoDependents.put(messageId1, PENDING);
|
||||
twoDependents.put(messageId2, PENDING);
|
||||
final Map<MessageId, State> twoDependencies =
|
||||
new LinkedHashMap<MessageId, State>();
|
||||
final Map<MessageId, State> twoDependencies = new LinkedHashMap<>();
|
||||
twoDependencies.put(messageId1, DELIVERED);
|
||||
twoDependencies.put(messageId2, DELIVERED);
|
||||
final Transaction txn = new Transaction(null, true);
|
||||
@@ -979,8 +976,7 @@ public class ValidationManagerImplTest extends BrambleMockTestCase {
|
||||
|
||||
@Test
|
||||
public void testOnlyReadyPendingDependentsGetDelivered() throws Exception {
|
||||
final Map<MessageId, State> twoDependencies =
|
||||
new LinkedHashMap<MessageId, State>();
|
||||
final Map<MessageId, State> twoDependencies = new LinkedHashMap<>();
|
||||
twoDependencies.put(messageId, DELIVERED);
|
||||
twoDependencies.put(messageId2, UNKNOWN);
|
||||
final Transaction txn = new Transaction(null, true);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class LinuxSecureRandomSpiTest extends BrambleTestCase {
|
||||
System.err.println("WARNING: Skipping test, can't run on this OS");
|
||||
return;
|
||||
}
|
||||
Set<Bytes> seeds = new HashSet<Bytes>();
|
||||
Set<Bytes> seeds = new HashSet<>();
|
||||
LinuxSecureRandomSpi engine = new LinuxSecureRandomSpi();
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
byte[] seed = engine.engineGenerateSeed(SEED_BYTES);
|
||||
|
||||
@@ -63,7 +63,7 @@ public class KeyManagerImplTest extends BrambleTestCase {
|
||||
Author remoteAuthor = new Author(remoteAuthorId, "author",
|
||||
getRandomBytes(42));
|
||||
AuthorId localAuthorId = new AuthorId(getRandomId());
|
||||
final Collection<Contact> contacts = new ArrayList<Contact>();
|
||||
final Collection<Contact> contacts = new ArrayList<>();
|
||||
contacts.add(new Contact(contactId, remoteAuthor, localAuthorId, true,
|
||||
true));
|
||||
contacts.add(new Contact(inactiveContactId, remoteAuthor, localAuthorId,
|
||||
|
||||
@@ -63,8 +63,7 @@ public class TransportKeyManagerImplTest extends BrambleTestCase {
|
||||
context.mock(ScheduledExecutorService.class);
|
||||
final Clock clock = context.mock(Clock.class);
|
||||
|
||||
final Map<ContactId, TransportKeys> loaded =
|
||||
new LinkedHashMap<ContactId, TransportKeys>();
|
||||
final Map<ContactId, TransportKeys> loaded = new LinkedHashMap<>();
|
||||
final TransportKeys shouldRotate = createTransportKeys(900, 0);
|
||||
final TransportKeys shouldNotRotate = createTransportKeys(1000, 0);
|
||||
loaded.put(contactId, shouldRotate);
|
||||
@@ -343,7 +342,7 @@ public class TransportKeyManagerImplTest extends BrambleTestCase {
|
||||
final boolean alice = true;
|
||||
final TransportKeys transportKeys = createTransportKeys(1000, 0);
|
||||
// Keep a copy of the tags
|
||||
final List<byte[]> tags = new ArrayList<byte[]>();
|
||||
final List<byte[]> tags = new ArrayList<>();
|
||||
final Transaction txn = new Transaction(null, false);
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
|
||||
Reference in New Issue
Block a user