Fixed indentation.

This commit is contained in:
akwizgran
2016-04-06 13:33:44 +01:00
parent d38aa4fd9b
commit 3c2378e024

View File

@@ -31,57 +31,57 @@ public class TransportPropertyValidatorTest extends BriarTestCase {
private final Message message; private final Message message;
private final TransportPropertyValidator tpv; private final TransportPropertyValidator tpv;
public TransportPropertyValidatorTest() { public TransportPropertyValidatorTest() {
transportId = new TransportId("test"); transportId = new TransportId("test");
bdfDictionary = new BdfDictionary(); bdfDictionary = new BdfDictionary();
GroupId groupId = new GroupId(TestUtils.getRandomId()); GroupId groupId = new GroupId(TestUtils.getRandomId());
ClientId clientId = new ClientId(TestUtils.getRandomId()); ClientId clientId = new ClientId(TestUtils.getRandomId());
byte[] descriptor = TestUtils.getRandomBytes(12); byte[] descriptor = TestUtils.getRandomBytes(12);
group = new Group(groupId, clientId, descriptor); group = new Group(groupId, clientId, descriptor);
MessageId messageId = new MessageId(TestUtils.getRandomId()); MessageId messageId = new MessageId(TestUtils.getRandomId());
long timestamp = System.currentTimeMillis(); long timestamp = System.currentTimeMillis();
byte[] body = TestUtils.getRandomBytes(123); byte[] body = TestUtils.getRandomBytes(123);
message = new Message(messageId, groupId, timestamp, body); message = new Message(messageId, groupId, timestamp, body);
Mockery context = new Mockery(); Mockery context = new Mockery();
ClientHelper clientHelper = context.mock(ClientHelper.class); ClientHelper clientHelper = context.mock(ClientHelper.class);
MetadataEncoder metadataEncoder = context.mock(MetadataEncoder.class); MetadataEncoder metadataEncoder = context.mock(MetadataEncoder.class);
Clock clock = context.mock(Clock.class); Clock clock = context.mock(Clock.class);
tpv = new TransportPropertyValidator(clientHelper, metadataEncoder, tpv = new TransportPropertyValidator(clientHelper, metadataEncoder,
clock); clock);
} }
@Test @Test
public void testValidateProperMessage() throws IOException { public void testValidateProperMessage() throws IOException {
BdfList body = BdfList.of(transportId.getString(), 4, bdfDictionary); BdfList body = BdfList.of(transportId.getString(), 4, bdfDictionary);
BdfDictionary result = tpv.validateMessage(message, group, body); BdfDictionary result = tpv.validateMessage(message, group, body);
assertEquals("test", result.getString("transportId")); assertEquals("test", result.getString("transportId"));
assertEquals(4, result.getLong("version").longValue()); assertEquals(4, result.getLong("version").longValue());
} }
@Test(expected = FormatException.class) @Test(expected = FormatException.class)
public void testValidateWrongVersionValue() throws IOException { public void testValidateWrongVersionValue() throws IOException {
BdfList body = BdfList.of(transportId.getString(), -1, bdfDictionary); BdfList body = BdfList.of(transportId.getString(), -1, bdfDictionary);
tpv.validateMessage(message, group, body); tpv.validateMessage(message, group, body);
} }
@Test(expected = FormatException.class) @Test(expected = FormatException.class)
public void testValidateWrongVersionType() throws IOException { public void testValidateWrongVersionType() throws IOException {
BdfList body = BdfList.of(transportId.getString(), bdfDictionary, BdfList body = BdfList.of(transportId.getString(), bdfDictionary,
bdfDictionary); bdfDictionary);
tpv.validateMessage(message, group, body); tpv.validateMessage(message, group, body);
} }
@Test(expected = FormatException.class) @Test(expected = FormatException.class)
public void testValidateLongTransportId() throws IOException { public void testValidateLongTransportId() throws IOException {
String wrongTransportIdString = String wrongTransportIdString =
TestUtils.getRandomString(MAX_TRANSPORT_ID_LENGTH + 1); TestUtils.getRandomString(MAX_TRANSPORT_ID_LENGTH + 1);
@@ -97,9 +97,9 @@ public class TransportPropertyValidatorTest extends BriarTestCase {
} }
@Test(expected = FormatException.class) @Test(expected = FormatException.class)
public void testValidateTooManyProperties() throws IOException { public void testValidateTooManyProperties() throws IOException {
BdfDictionary d = new BdfDictionary(); BdfDictionary d = new BdfDictionary();
for (int i = 0; i < MAX_PROPERTIES_PER_TRANSPORT + 1; i++) for (int i = 0; i < MAX_PROPERTIES_PER_TRANSPORT + 1; i++)
d.put(String.valueOf(i), i); d.put(String.valueOf(i), i);
BdfList body = BdfList.of(transportId.getString(), 4, d); BdfList body = BdfList.of(transportId.getString(), 4, d);