demery-pivotal commented on code in PR #7585:
URL: https://github.com/apache/geode/pull/7585#discussion_r849739507


##########
geode-gfsh/src/integrationTest/java/org/apache/geode/management/internal/cli/commands/StartMemberUtilsTest.java:
##########
@@ -151,77 +163,82 @@ public void testExtensionsJars() throws IOException {
     assertThat(gemfireClasspath).doesNotContain("extensions");
 
     // when there is a `test.jar` in `extensions` directory
-    File folder = temporaryFolder.newFolder("extensions");
+    File folder = new File(temporaryFolder, "extensions");
+    Files.createDirectories(folder.toPath());
     File jarFile = new File(folder, "test.jar");
-    jarFile.createNewFile();
+    assertThat(jarFile.createNewFile()).isTrue();
     gemfireClasspath = StartMemberUtils.toClasspath(true, new String[] 
{jarFile.getAbsolutePath()});
     assertThat(gemfireClasspath).contains(jarFile.getName());
 
   }
 
+  @EnabledForJreRange(max = JAVA_13)
   @Test
-  public void testAddMaxHeap() {
+  public void testAddMaxHeapWithCMS() {
     List<String> baseCommandLine = new ArrayList<>();
 
     // Empty Max Heap Option
     StartMemberUtils.addMaxHeap(baseCommandLine, null);
-    assertThat(baseCommandLine.size()).isEqualTo(0);
+    assertThat(baseCommandLine).isEmpty();
 
     StartMemberUtils.addMaxHeap(baseCommandLine, "");
-    assertThat(baseCommandLine.size()).isEqualTo(0);
+    assertThat(baseCommandLine).isEmpty();
 
     // Only Max Heap Option Set
     StartMemberUtils.addMaxHeap(baseCommandLine, "32g");
-    assertThat(baseCommandLine.size()).isEqualTo(3);
     assertThat(baseCommandLine).containsExactly("-Xmx32g", 
"-XX:+UseConcMarkSweepGC",
-        "-XX:CMSInitiatingOccupancyFraction=" + 
StartMemberUtils.CMS_INITIAL_OCCUPANCY_FRACTION);
+        "-XX:CMSInitiatingOccupancyFraction=" + 
MemberJvmOptions.CMS_INITIAL_OCCUPANCY_FRACTION);
 
     // All Options Set
     List<String> customCommandLine = new ArrayList<>(
         Arrays.asList("-XX:+UseConcMarkSweepGC", 
"-XX:CMSInitiatingOccupancyFraction=30"));
     StartMemberUtils.addMaxHeap(customCommandLine, "16g");
-    assertThat(customCommandLine.size()).isEqualTo(3);
     assertThat(customCommandLine).containsExactly("-XX:+UseConcMarkSweepGC",
         "-XX:CMSInitiatingOccupancyFraction=30", "-Xmx16g");
   }
 
-  private void writePid(final File pidFile, final int pid) throws IOException {
-    final FileWriter fileWriter = new FileWriter(pidFile, false);
-    fileWriter.write(String.valueOf(pid));
-    fileWriter.write("\n");
-    fileWriter.flush();
-    IOUtils.close(fileWriter);
+  @EnabledForJreRange(min = JAVA_14)
+  @Test
+  public void testAddMaxHeapWithoutCMS() {
+    List<String> baseCommandLine = new ArrayList<>();
+
+    // Empty Max Heap Option
+    StartMemberUtils.addMaxHeap(baseCommandLine, null);
+    assertThat(baseCommandLine).isEmpty();

Review Comment:
   Consider either of these, to give the failure message a bit more information 
about the nature of the `maxHeap` argument that caused the failure:
   - Separate these assertions into separate tests with names that describe 
`maxHeap`. E.g. `addNullMaxHeapWithoutCMS()`.
   - Distinguish the assertions by adding `as(…)` to describe the max heap 
parameter. E.g. `as("command line from null maxHeap parameter")`.



-- 
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: notifications-unsubscr...@geode.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to