[
https://issues.apache.org/jira/browse/GEODE-3539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16291752#comment-16291752
]
ASF GitHub Bot commented on GEODE-3539:
---------------------------------------
PurelyApplied commented on a change in pull request #1162: GEODE-3539: add
tests for ExportStackTraceCommand
URL: https://github.com/apache/geode/pull/1162#discussion_r157084998
##########
File path:
geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportStackTraceCommandTest.java
##########
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express
+ * or implied. See the License for the specific language governing permissions
and limitations under
+ * the License.
+ */
+
+package org.apache.geode.management.internal.cli.commands;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TemporaryFolder;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.apache.geode.test.junit.rules.GfshParserRule;
+
+
+@Category(UnitTest.class)
+public class ExportStackTraceCommandTest {
+
+ @ClassRule
+ public static GfshParserRule gfsh = new GfshParserRule();
+
+ @Rule
+ public TemporaryFolder temporaryFolder = new TemporaryFolder();
+
+ private ExportStackTraceCommand command;
+
+ @Before
+ public void before() {
+ command = spy(ExportStackTraceCommand.class);
+ }
+
+ @Test
+ public void noMemberFound() {
+ doReturn(Collections.emptySet()).when(command).findMembers(any(), any());
+ gfsh.executeAndAssertThat(command, "export stack-traces").statusIsError()
+ .containsOutput("No Members Found");
+ }
+
+ @Test
+ public void fileExists() throws IOException {
Review comment:
At first glance, I thought the second assertion was an accidental redundancy
of the test above. I eventually read your comment and realized the test was
verifying that we check for the file existing before anything else.
For clarity, I might prefer a test name like `abortImmediatelyIfFileExists`.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> Add more test coverage for p2p commands
> ---------------------------------------
>
> Key: GEODE-3539
> URL: https://issues.apache.org/jira/browse/GEODE-3539
> Project: Geode
> Issue Type: Improvement
> Components: gfsh
> Reporter: Jinmei Liao
>
> Add more command tests that would eventually get rid of the legacy tests.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)