nandorsoma commented on code in PR #6046:
URL: https://github.com/apache/nifi/pull/6046#discussion_r881339212
##########
nifi-nar-bundles/nifi-snmp-bundle/nifi-snmp-processors/src/test/java/org/apache/nifi/snmp/configuration/V1TrapConfigurationTest.java:
##########
@@ -49,29 +44,32 @@ public void testMembersAreSetCorrectly() {
}
@Test
- public void testRequireNonNullEnterpriseOid() {
- exceptionRule.expect(IllegalArgumentException.class);
- exceptionRule.expectMessage("Enterprise OID must be specified.");
- V1TrapConfiguration.builder()
- .agentAddress(AGENT_ADDRESS)
- .genericTrapType(String.valueOf(GENERIC_TRAP_TYPE))
- .specificTrapType(String.valueOf(SPECIFIC_TRAP_TYPE))
- .build();
+ void testRequireNonNullEnterpriseOid() {
+ final IllegalArgumentException exception =
assertThrows(IllegalArgumentException.class, () ->
+ V1TrapConfiguration.builder()
+ .agentAddress(AGENT_ADDRESS)
+ .genericTrapType(String.valueOf(GENERIC_TRAP_TYPE))
+ .specificTrapType(String.valueOf(SPECIFIC_TRAP_TYPE))
+ .build()
+ );
+ assertEquals("Enterprise OID must be specified.",
exception.getMessage());
Review Comment:
I meant duplication among the test and the actual class. If you reference
the static variable from the class, you can ensure that you assert using the
correct value and there is no typo in it. This way ofc you assert the behavior,
not the actual meaning of the message, but I guess it is copy-paste anyway. I
leave it up to you if you want to change it after that. Sometimes it is a
pattern but I don't see that it is widely used in NiFi.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]