Skip to content

Commit

Permalink
let this test work on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ryber committed Jan 17, 2024
1 parent ef78939 commit 53bfd2f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 31 deletions.
34 changes: 18 additions & 16 deletions unirest/src/main/java/kong/unirest/core/json/CoreFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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" +
"<!-- Google Gson (the previous core impl) -->\n" +
"<dependency>\n" +
" <groupId>com.konghq</groupId>\n" +
" <artifactId>unirest-object-mappers-gson</artifactId>\n" +
" <version>${latest-version}</version>\n" +
"</dependency>\n" +
"\n" +
"<!-- Jackson -->\n" +
"<dependency>\n" +
" <groupId>com.konghq</groupId>\n" +
" <artifactId>unirest-object-mappers-jackson</artifactId>\n" +
" <version>${latest-version}</version>\n" +
"</dependency>)");
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" +
"<!-- Google Gson (the previous core impl) -->%n" +
"<dependency>%n" +
" <groupId>com.konghq</groupId>%n" +
" <artifactId>unirest-object-mappers-gson</artifactId>%n" +
" <version>${latest-version}</version>%n" +
"</dependency>%n" +
"%n" +
"<!-- Jackson -->%n" +
"<dependency>%n" +
" <groupId>com.konghq</groupId>%n" +
" <artifactId>unirest-object-mappers-jackson</artifactId>%n" +
" <version>${latest-version}</version>%n" +
"</dependency>)%n%n" +
"Alternatively you may register your own JsonEngine directly with CoreFactory.setEngine(JsonEngine jsonEngine)"));
}
}
32 changes: 17 additions & 15 deletions unirest/src/test/java/kong/unirest/core/json/CoreFactoryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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" +
"<!-- Google Gson (the previous core impl) -->\n" +
"<dependency>\n" +
" <groupId>com.konghq</groupId>\n" +
" <artifactId>unirest-object-mappers-gson</artifactId>\n" +
" <version>${latest-version}</version>\n" +
"</dependency>\n" +
"\n" +
"<!-- Jackson -->\n" +
"<dependency>\n" +
" <groupId>com.konghq</groupId>\n" +
" <artifactId>unirest-object-mappers-jackson</artifactId>\n" +
" <version>${latest-version}</version>\n" +
"</dependency>)", 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" +
"<!-- Google Gson (the previous core impl) -->%n" +
"<dependency>%n" +
" <groupId>com.konghq</groupId>%n" +
" <artifactId>unirest-object-mappers-gson</artifactId>%n" +
" <version>${latest-version}</version>%n" +
"</dependency>%n" +
"%n" +
"<!-- Jackson -->%n" +
"<dependency>%n" +
" <groupId>com.konghq</groupId>%n" +
" <artifactId>unirest-object-mappers-jackson</artifactId>%n" +
" <version>${latest-version}</version>%n" +
"</dependency>)%n" +
"%n" +
"Alternatively you may register your own JsonEngine directly with CoreFactory.setEngine(JsonEngine jsonEngine)"), ex.getMessage());
}

@Test
Expand Down

0 comments on commit 53bfd2f

Please sign in to comment.