tasanuma commented on a change in pull request #2983:
URL: https://github.com/apache/hadoop/pull/2983#discussion_r630937412
##########
File path:
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/alias/TestCredentialProviderFactory.java
##########
@@ -250,18 +247,14 @@ public void testLocalJksProvider() throws Exception {
}
@Test
- public void testLocalBCFKSProvider() throws Exception {
+ public void testLocalBCFKSProvider() {
Configuration conf = new Configuration();
final Path ksPath = new Path(tmpDir.toString(), "test.bcfks");
final String ourUrl = LocalBouncyCastleFipsKeyStoreProvider.SCHEME_NAME +
"://file" + ksPath.toUri();
conf.set(CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, ourUrl);
-
- exception.expect(IOException.class);
- exception.expectMessage("Can't create keystore");
- List<CredentialProvider> providers =
- CredentialProviderFactory.getProviders(conf);
- assertTrue("BCFKS needs additional JDK setup", providers.isEmpty());
+ assertThrows("Can't create keystore", IOException.class,
+ () -> CredentialProviderFactory.getProviders(conf));
Review comment:
It seems not to validate the error message. Per the [junit
docs](https://junit.org/junit5/docs/current/user-guide/#writing-tests-assertions),
```suggestion
Exception exception = assertThrows(IOException.class,
() -> CredentialProviderFactory.getProviders(conf));
assertEquals("Can't create keystore", exception.getMessage());
```
##########
File path:
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/conf/TestConfiguration.java
##########
@@ -50,6 +50,7 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
+import org.assertj.core.api.Assertions;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
Review comment:
```suggestion
```
--
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]