Skip to content
Snippets Groups Projects
Unverified Commit e2bbe742 authored by akwizgran's avatar akwizgran
Browse files

Moved some boilerplate into a field.

parent eaf17c05
No related branches found
No related tags found
No related merge requests found
......@@ -22,6 +22,17 @@ import static org.junit.Assert.fail;
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 BdfDictionary dictionary = new BdfDictionary();
private final Metadata meta = new Metadata();
......@@ -37,16 +48,7 @@ public class BdfMessageValidatorTest extends ValidatorTestCase {
will(returnValue(timestamp - MAX_CLOCK_DIFFERENCE - 1));
}});
BdfMessageValidator v = new BdfMessageValidator(clientHelper,
metadataEncoder, clock) {
@Override
protected BdfMessageContext validateMessage(Message m, Group g,
BdfList b) throws InvalidMessageException, FormatException {
fail();
return null;
}
};
v.validateMessage(message, group);
subclassNotCalled.validateMessage(message, group);
}
@Test
......@@ -92,16 +94,7 @@ public class BdfMessageValidatorTest extends ValidatorTestCase {
will(returnValue(invalidRaw));
}});
BdfMessageValidator v = new BdfMessageValidator(clientHelper,
metadataEncoder, clock) {
@Override
protected BdfMessageContext validateMessage(Message m, Group g,
BdfList b) throws InvalidMessageException, FormatException {
fail();
return null;
}
};
v.validateMessage(invalidMessage, group);
subclassNotCalled.validateMessage(invalidMessage, group);
}
@Test
......@@ -146,16 +139,7 @@ public class BdfMessageValidatorTest extends ValidatorTestCase {
will(throwException(new FormatException()));
}});
BdfMessageValidator v = new BdfMessageValidator(clientHelper,
metadataEncoder, clock) {
@Override
protected BdfMessageContext validateMessage(Message m, Group g,
BdfList b) throws InvalidMessageException, FormatException {
fail();
return null;
}
};
v.validateMessage(message, group);
subclassNotCalled.validateMessage(message, group);
}
@Test(expected = InvalidMessageException.class)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment