Merge pull request #23592 from pzygielo/23590

Extract and test method to construct message
diff --git a/appserver/admingui/common/src/main/resources/org/glassfish/common/admingui/Strings.properties b/appserver/admingui/common/src/main/resources/org/glassfish/common/admingui/Strings.properties
index 7ca7a72..739ecac 100644
--- a/appserver/admingui/common/src/main/resources/org/glassfish/common/admingui/Strings.properties
+++ b/appserver/admingui/common/src/main/resources/org/glassfish/common/admingui/Strings.properties
@@ -1,5 +1,6 @@
 #
 # Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2021 Contributors to the Eclipse Foundation
 #
 # This program and the accompanying materials are made available under the
 # terms of the Eclipse Public License v. 2.0, which is available at
@@ -892,7 +893,7 @@
 log.afterWriteToTmpFile=After writing to temp file ...
 log.inUploadFileToTmpDir=In upLoadFileToTempDir
 log.indeleteFileFromTempDir= In deleteFileFromtempDir
-log.fileCouldntbeFound=file Couldn't be found at {0}, proceeding execution without deletion.
+log.fileCouldntbeFound=file Couldn''t be found at {0}, proceeding execution without deletion.
 
 pswdAlias.tab=Password Aliases
 pswdAlias.tabTip=Password Aliases
diff --git a/appserver/admingui/core/pom.xml b/appserver/admingui/core/pom.xml
index 2ea6bfc..74062bd 100644
--- a/appserver/admingui/core/pom.xml
+++ b/appserver/admingui/core/pom.xml
@@ -2,6 +2,7 @@
 <!--
 
     Copyright (c) 1997, 2021 Oracle and/or its affiliates. All rights reserved.
+    Copyright (c) 2021 Contributors to the Eclipse Foundation
 
     This program and the accompanying materials are made available under the
     terms of the Eclipse Public License v. 2.0, which is available at
@@ -55,5 +56,9 @@
             <version>${project.version}</version>
             <scope>provided</scope>
         </dependency>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+        </dependency>
     </dependencies>
 </project>
diff --git a/appserver/admingui/core/src/main/java/org/glassfish/admingui/handlers/WoodstockHandler.java b/appserver/admingui/core/src/main/java/org/glassfish/admingui/handlers/WoodstockHandler.java
index f1969a2..9c00fd4 100644
--- a/appserver/admingui/core/src/main/java/org/glassfish/admingui/handlers/WoodstockHandler.java
+++ b/appserver/admingui/core/src/main/java/org/glassfish/admingui/handlers/WoodstockHandler.java
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2021 Contributors to the Eclipse Foundation
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v. 2.0, which is available at
@@ -94,7 +95,7 @@
                 Files.delete(pathToFile);
 
             } catch (IOException x) {
-                logger.log(Level.WARNING, GuiUtil.getCommonMessage("log.fileCouldntbeFound", new Object[]{"" + deleteTempFile}));
+                logger.log(Level.WARNING, prepareFileNotDeletedMessage(deleteTempFile));
 
             } catch (SecurityException e) {
 
@@ -102,6 +103,10 @@
         }
     }
 
+    static String prepareFileNotDeletedMessage(String file) {
+      return GuiUtil.getCommonMessage("log.fileCouldntbeFound", new Object[] { file });
+    }
+
 
     /**
      * <p>
diff --git a/appserver/admingui/core/src/test/java/org/glassfish/admingui/handlers/WoodstockHandlerTest.java b/appserver/admingui/core/src/test/java/org/glassfish/admingui/handlers/WoodstockHandlerTest.java
new file mode 100644
index 0000000..c71e68d
--- /dev/null
+++ b/appserver/admingui/core/src/test/java/org/glassfish/admingui/handlers/WoodstockHandlerTest.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2021 Contributors to the Eclipse Foundation
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v. 2.0, which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * This Source Code may also be made available under the following Secondary
+ * Licenses when the conditions for such availability set forth in the
+ * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
+ * version 2 with the GNU Classpath Exception, which is available at
+ * https://www.gnu.org/software/classpath/license.html.
+ *
+ * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
+ */
+
+package org.glassfish.admingui.handlers;
+
+import org.junit.jupiter.api.Test;
+
+public class WoodstockHandlerTest {
+  @Test
+  public void testMessageForNullName() {
+    var actual = WoodstockHandler.prepareFileNotDeletedMessage(null);
+
+    assert "file Couldn't be found at null, proceeding execution without deletion.".equals(actual) : actual;
+  }
+
+  @Test
+  public void testMessageForNonNullName() {
+    var actual = WoodstockHandler.prepareFileNotDeletedMessage("abcd");
+
+    assert "file Couldn't be found at abcd, proceeding execution without deletion.".equals(actual) : actual;
+  }
+}
+