patalwell commented on code in PR #5905:
URL: https://github.com/apache/nifi/pull/5905#discussion_r844420698
##########
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/test/java/org/apache/nifi/processors/aws/cloudwatch/TestPutCloudWatchMetric.java:
##########
@@ -264,27 +265,34 @@ public void testMetricExpressionInvalidRoutesToFailure()
throws Exception {
runner.enqueue(new byte[] {}, attributes);
runner.run();
- assertEquals(0, mockPutCloudWatchMetric.putMetricDataCallCount);
+ Assert.assertEquals(0, mockPutCloudWatchMetric.putMetricDataCallCount);
runner.assertAllFlowFilesTransferred(PutCloudWatchMetric.REL_FAILURE,
1);
}
- @Test
- public void testInvalidUnitRoutesToFailure() throws Exception {
+ @ParameterizedTest
+ @CsvSource({"nan","percent","count"})
+ public void testInvalidUnit(String unit) throws Exception {
MockPutCloudWatchMetric mockPutCloudWatchMetric = new
MockPutCloudWatchMetric();
- mockPutCloudWatchMetric.throwException = new
InvalidParameterValueException("Unit error message");
final TestRunner runner =
TestRunners.newTestRunner(mockPutCloudWatchMetric);
runner.setProperty(PutCloudWatchMetric.NAMESPACE, "TestNamespace");
runner.setProperty(PutCloudWatchMetric.METRIC_NAME, "TestMetric");
- runner.setProperty(PutCloudWatchMetric.UNIT, "BogusUnit");
- runner.setProperty(PutCloudWatchMetric.VALUE, "1");
- runner.assertValid();
+ runner.setProperty(PutCloudWatchMetric.UNIT, unit);
+ runner.setProperty(PutCloudWatchMetric.VALUE, "1.0");
+ runner.assertNotValid();
+ }
- runner.enqueue(new byte[] {});
- runner.run();
+ @ParameterizedTest
+ @CsvSource({"Count","Bytes","Percent"})
Review Comment:
Good point. I'll work on this!
--
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]