From a83c3e3f18ef6393c6dc9c7c61dd5f1ab8aa7226 Mon Sep 17 00:00:00 2001 From: Onur D Date: Mon, 16 Oct 2023 17:37:33 +0200 Subject: [PATCH] Fixed one test case based on the operating system in order to generate the exception "URI path component is empty". Also, attempted to make tests run and pass both in windows and linux by changing the file separator if the OS is Windows. --- .../core/problem/rest/OpenAPILocalURLIssueTest.kt | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/core/src/test/kotlin/org/evomaster/core/problem/rest/OpenAPILocalURLIssueTest.kt b/core/src/test/kotlin/org/evomaster/core/problem/rest/OpenAPILocalURLIssueTest.kt index 20d73d3d2c..cbd81c32ce 100644 --- a/core/src/test/kotlin/org/evomaster/core/problem/rest/OpenAPILocalURLIssueTest.kt +++ b/core/src/test/kotlin/org/evomaster/core/problem/rest/OpenAPILocalURLIssueTest.kt @@ -153,10 +153,15 @@ class OpenAPILocalURLIssueTest { swagger = OpenApiAccess.getOpenAPIFromURL(urlToTest) } - // The message in the SutException should be "The file path provided for the OpenAPI Schema - // $urlToTest , is not a valid path" - Assertions.assertTrue(exception.message!!.contains("The file path provided for the OpenAPI Schema " + - "$urlToTest," + " ended up with the following error: ")) + // In windows, the file cannot be located, in others the error is URL related + if (hostOs.contains("win")) { + Assertions.assertTrue(exception.message!!.contains("The provided swagger file " + + "does not exist: $urlToTest")) + } + else { + Assertions.assertTrue(exception.message!!.contains("The file path provided for the OpenAPI Schema " + + "$urlToTest," + " ended up with the following error: ")) + } } @Test