diff --git a/unirest/src/main/java/kong/unirest/core/json/CoreFactory.java b/unirest/src/main/java/kong/unirest/core/json/CoreFactory.java index 7b30f6ca..876e308b 100644 --- a/unirest/src/main/java/kong/unirest/core/json/CoreFactory.java +++ b/unirest/src/main/java/kong/unirest/core/json/CoreFactory.java @@ -146,21 +146,23 @@ public static JsonEngine findEngineWithClassLoader() { } private static UnirestConfigException getException() { - return new UnirestConfigException("No Json Parsing Implementation Provided\n" + - "Please add a dependency for a Unirest JSON Engine. This can be one of:" + - "\n" + - "\n" + - "\n" + - " com.konghq\n" + - " unirest-object-mappers-gson\n" + - " ${latest-version}\n" + - "\n" + - "\n" + - "\n" + - "\n" + - " com.konghq\n" + - " unirest-object-mappers-jackson\n" + - " ${latest-version}\n" + - ")"); + return new UnirestConfigException(String.format("No Json Parsing Implementation Provided%n" + + "Please add a dependency for a Unirest JSON Engine. " + + "This can be one of:" + + "%n" + + "%n" + + "%n" + + " com.konghq%n" + + " unirest-object-mappers-gson%n" + + " ${latest-version}%n" + + "%n" + + "%n" + + "%n" + + "%n" + + " com.konghq%n" + + " unirest-object-mappers-jackson%n" + + " ${latest-version}%n" + + ")%n%n" + + "Alternatively you may register your own JsonEngine directly with CoreFactory.setEngine(JsonEngine jsonEngine)")); } } diff --git a/unirest/src/test/java/kong/unirest/core/json/CoreFactoryTest.java b/unirest/src/test/java/kong/unirest/core/json/CoreFactoryTest.java index 71c8e126..b0ae5bce 100644 --- a/unirest/src/test/java/kong/unirest/core/json/CoreFactoryTest.java +++ b/unirest/src/test/java/kong/unirest/core/json/CoreFactoryTest.java @@ -48,21 +48,23 @@ void whenThereIsNoImpl() { CoreFactory.setEngine(null); var ex = assertThrows(UnirestConfigException.class, () -> CoreFactory.getCore()); - assertEquals("No Json Parsing Implementation Provided\n" + - "Please add a dependency for a Unirest JSON Engine. This can be one of:\n" + - "\n" + - "\n" + - " com.konghq\n" + - " unirest-object-mappers-gson\n" + - " ${latest-version}\n" + - "\n" + - "\n" + - "\n" + - "\n" + - " com.konghq\n" + - " unirest-object-mappers-jackson\n" + - " ${latest-version}\n" + - ")", ex.getMessage()); + assertEquals(String.format("No Json Parsing Implementation Provided%n" + + "Please add a dependency for a Unirest JSON Engine. This can be one of:%n" + + "%n" + + "%n" + + " com.konghq%n" + + " unirest-object-mappers-gson%n" + + " ${latest-version}%n" + + "%n" + + "%n" + + "%n" + + "%n" + + " com.konghq%n" + + " unirest-object-mappers-jackson%n" + + " ${latest-version}%n" + + ")%n" + + "%n" + + "Alternatively you may register your own JsonEngine directly with CoreFactory.setEngine(JsonEngine jsonEngine)"), ex.getMessage()); } @Test