cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From buhhu...@apache.org
Subject [cxf] branch master updated: [cxf-tools-validator] use String.join
Date Wed, 20 Mar 2019 09:13:35 GMT
This is an automated email from the ASF dual-hosted git repository.

buhhunyx pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git


The following commit(s) were added to refs/heads/master by this push:
     new cbe9b58  [cxf-tools-validator] use String.join
cbe9b58 is described below

commit cbe9b58888d2270bdc2b9cb6d97e4d834bcebc10
Author: amarkevich <amarkevich@talend.com>
AuthorDate: Wed Mar 20 12:13:05 2019 +0300

    [cxf-tools-validator] use String.join
---
 .../org/apache/cxf/tools/validator/AbstractValidator.java    | 10 +---------
 .../cxf/tools/validator/internal/WSDL11ValidatorTest.java    | 12 +++++++-----
 2 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/tools/validator/src/main/java/org/apache/cxf/tools/validator/AbstractValidator.java
b/tools/validator/src/main/java/org/apache/cxf/tools/validator/AbstractValidator.java
index cf01921..5c01c66 100644
--- a/tools/validator/src/main/java/org/apache/cxf/tools/validator/AbstractValidator.java
+++ b/tools/validator/src/main/java/org/apache/cxf/tools/validator/AbstractValidator.java
@@ -25,9 +25,6 @@ import java.util.List;
 public abstract class AbstractValidator {
     protected List<String> errorMessages = new ArrayList<>();
 
-    public AbstractValidator() {
-    }
-
     public abstract boolean isValid();
 
     public void addErrorMessage(String err) {
@@ -35,11 +32,6 @@ public abstract class AbstractValidator {
     }
 
     public String getErrorMessage() {
-        StringBuilder strbuffer = new StringBuilder();
-        for (int i = 0; i < errorMessages.size(); i++) {
-            strbuffer.append(errorMessages.get(i));
-            strbuffer.append(System.getProperty("line.separator"));
-        }
-        return strbuffer.toString();
+        return String.join(System.getProperty("line.separator"), errorMessages);
     }
 }
diff --git a/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDL11ValidatorTest.java
b/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDL11ValidatorTest.java
index d175c44..314635b 100644
--- a/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDL11ValidatorTest.java
+++ b/tools/validator/src/test/java/org/apache/cxf/tools/validator/internal/WSDL11ValidatorTest.java
@@ -24,8 +24,8 @@ import org.apache.cxf.tools.common.ToolContext;
 
 import org.junit.Test;
 
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 public class WSDL11ValidatorTest {
     private ToolContext context = new ToolContext();
@@ -36,11 +36,13 @@ public class WSDL11ValidatorTest {
         context.put(ToolConstants.CFG_WSDLURL, wsdlSource);
         WSDL11Validator validator = new WSDL11Validator(null, context);
         try {
-            assertFalse(validator.isValid());
+            validator.isValid();
+            fail();
         } catch (Exception e) {
-            assertTrue(e.getMessage(), e.getMessage()
-                           .indexOf("Caused by {http://apache.org/hello_world/messages}"
-                                              + "[portType:GreeterA][operation:sayHi] not
exist.") != -1);
+            final String error = "Caused by {http://apache.org/hello_world/messages}"
+                    + "[portType:GreeterA][operation:sayHi] not exist.";
+            assertTrue(e.getMessage(), e.getMessage().contains(error));
+            assertTrue(validator.getErrorMessage(), validator.getErrorMessage().contains(error));
         }
     }
 }
\ No newline at end of file


Mime
View raw message