hemantk-12 commented on code in PR #3993:
URL: https://github.com/apache/ozone/pull/3993#discussion_r1039863062
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOmMetadataManager.java:
##########
@@ -62,16 +74,26 @@ public class TestOmMetadataManager {
private OMMetadataManager omMetadataManager;
private OzoneConfiguration ozoneConfiguration;
+ @TempDir
+ private File folder;
- @Rule
- public TemporaryFolder folder = new TemporaryFolder();
-
+ public static <E extends Throwable> void expectOmException(
Review Comment:
`Assertions.assertThrows()` returns the exception. You can verify exception
code there. You can do the following:
1.
```
OMException omException = assertThrows(OMException.class,
() -> omMetadataManager.listSnapshot(volume, bucket));
assertEquals(expectedResultCode, omException.getResult());
```
2.
```
OMException omException = assertThrows(OMException.class,
() -> omMetadataManager.listSnapshot(volume, bucket),
"Should have thrown OMException");
assertEquals(expectedResultCode, omException.getResult());
```
https://howtodoinjava.com/junit5/expected-exception-example/
--
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]