sodonnel commented on code in PR #10493:
URL: https://github.com/apache/ozone/pull/10493#discussion_r3429376206
##########
hadoop-ozone/cli-admin/src/test/java/org/apache/hadoop/ozone/admin/upgrade/TestFinalizeSubCommand.java:
##########
@@ -42,10 +44,21 @@ public class TestFinalizeSubCommand {
private final ByteArrayOutputStream outContent = new ByteArrayOutputStream();
private final PrintStream originalOut = System.out;
private FinalizeSubCommand cmd;
+ private OzoneManagerProtocol omClient;
@BeforeEach
- public void setup() throws UnsupportedEncodingException {
- cmd = new FinalizeSubCommand();
+ public void setup() throws IOException {
+ omClient = mock(OzoneManagerProtocol.class);
+
+ // Mock close() to do nothing - needed for try-with-resources
+ doNothing().when(omClient).close();
+
+ cmd = new FinalizeSubCommand() {
+ @Override
+ protected OzoneManagerProtocol getClient() throws Exception {
+ return omClient;
+ }
+ };
Review Comment:
Maybe, but this was the pattern used in some other tests and its simple
enough I think.
--
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]