mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 20:59:54 +01:00
Moved some boilerplate into a field.
This commit is contained in:
@@ -22,6 +22,17 @@ import static org.junit.Assert.fail;
|
|||||||
|
|
||||||
public class BdfMessageValidatorTest extends ValidatorTestCase {
|
public class BdfMessageValidatorTest extends ValidatorTestCase {
|
||||||
|
|
||||||
|
private final BdfMessageValidator subclassNotCalled =
|
||||||
|
new BdfMessageValidator(clientHelper, metadataEncoder, clock) {
|
||||||
|
@Override
|
||||||
|
protected BdfMessageContext validateMessage(Message m, Group g,
|
||||||
|
BdfList body)
|
||||||
|
throws InvalidMessageException, FormatException {
|
||||||
|
fail();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
private final BdfList body = BdfList.of(123, 456);
|
private final BdfList body = BdfList.of(123, 456);
|
||||||
private final BdfDictionary dictionary = new BdfDictionary();
|
private final BdfDictionary dictionary = new BdfDictionary();
|
||||||
private final Metadata meta = new Metadata();
|
private final Metadata meta = new Metadata();
|
||||||
@@ -37,16 +48,7 @@ public class BdfMessageValidatorTest extends ValidatorTestCase {
|
|||||||
will(returnValue(timestamp - MAX_CLOCK_DIFFERENCE - 1));
|
will(returnValue(timestamp - MAX_CLOCK_DIFFERENCE - 1));
|
||||||
}});
|
}});
|
||||||
|
|
||||||
BdfMessageValidator v = new BdfMessageValidator(clientHelper,
|
subclassNotCalled.validateMessage(message, group);
|
||||||
metadataEncoder, clock) {
|
|
||||||
@Override
|
|
||||||
protected BdfMessageContext validateMessage(Message m, Group g,
|
|
||||||
BdfList b) throws InvalidMessageException, FormatException {
|
|
||||||
fail();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
v.validateMessage(message, group);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -92,16 +94,7 @@ public class BdfMessageValidatorTest extends ValidatorTestCase {
|
|||||||
will(returnValue(invalidRaw));
|
will(returnValue(invalidRaw));
|
||||||
}});
|
}});
|
||||||
|
|
||||||
BdfMessageValidator v = new BdfMessageValidator(clientHelper,
|
subclassNotCalled.validateMessage(invalidMessage, group);
|
||||||
metadataEncoder, clock) {
|
|
||||||
@Override
|
|
||||||
protected BdfMessageContext validateMessage(Message m, Group g,
|
|
||||||
BdfList b) throws InvalidMessageException, FormatException {
|
|
||||||
fail();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
v.validateMessage(invalidMessage, group);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -146,16 +139,7 @@ public class BdfMessageValidatorTest extends ValidatorTestCase {
|
|||||||
will(throwException(new FormatException()));
|
will(throwException(new FormatException()));
|
||||||
}});
|
}});
|
||||||
|
|
||||||
BdfMessageValidator v = new BdfMessageValidator(clientHelper,
|
subclassNotCalled.validateMessage(message, group);
|
||||||
metadataEncoder, clock) {
|
|
||||||
@Override
|
|
||||||
protected BdfMessageContext validateMessage(Message m, Group g,
|
|
||||||
BdfList b) throws InvalidMessageException, FormatException {
|
|
||||||
fail();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
v.validateMessage(message, group);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(expected = InvalidMessageException.class)
|
@Test(expected = InvalidMessageException.class)
|
||||||
|
|||||||
Reference in New Issue
Block a user