FrankChen021 commented on code in PR #20031:
URL: https://github.com/apache/druid/pull/20031#discussion_r3800358115
##########
server/src/test/java/org/apache/druid/client/cache/CacheConfigTest.java:
##########
@@ -107,29 +108,33 @@
configProvider.inject(properties, configurator);
CacheConfig config = configProvider.get();
- Assert.assertEquals(99, config.getNumBackgroundThreads());
- Assert.assertEquals(false, config.isPopulateCache());
- Assert.assertEquals(false, config.isUseCache());
+ Assertions.assertEquals(99, config.getNumBackgroundThreads());
+ Assertions.assertEquals(false, config.isPopulateCache());
+ Assertions.assertEquals(false, config.isUseCache());
}
- @Test(expected = ProvisionException.class)
+ @Test
public void testValidationError()
{
- properties.put(PROPERTY_PREFIX + ".numBackgroundThreads", "-1");
+ Assertions.assertThrows(ProvisionException.class, () -> {
+ properties.put(PROPERTY_PREFIX + ".numBackgroundThreads", "-1");
- configProvider.inject(properties, configurator);
- CacheConfig config = configProvider.get();
- Assert.assertNotEquals(-1, config.getNumBackgroundThreads());
+ configProvider.inject(properties, configurator);
+ CacheConfig config = configProvider.get();
+ Assertions.assertNotEquals(-1, config.getNumBackgroundThreads());
+ });
}
- @Test(expected = ProvisionException.class)
+ @Test
public void testValidationInsaneError()
{
- properties.put(PROPERTY_PREFIX + ".numBackgroundThreads", "BABBA YAGA");
- configProvider.inject(properties, configurator);
- CacheConfig config = configProvider.get();
- throw new IllegalStateException("Should have already failed");
+ Assertions.assertThrows(ProvisionException.class, () -> {
+ properties.put(PROPERTY_PREFIX + ".numBackgroundThreads", "BABBA YAGA");
+ configProvider.inject(properties, configurator);
+ CacheConfig config = configProvider.get();
Review Comment:
I checked this against the PR base commit cb26014728. The CacheConfig config
local was already present and unused in the pre-migration
testValidationInsaneError; this PR only converted the JUnit 4
expected-exception syntax. Since this finding predates the PR, I am leaving the
code unchanged.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]