-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(837): Fix platform specific test failures
Tests that fail on os=win
- Loading branch information
Thorsten Schlathölter
committed
Jan 21, 2022
1 parent
d195eca
commit ab01258
Showing
18 changed files
with
119 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
import com.consol.citrus.mail.message.CitrusMailMessageHeaders; | ||
import com.consol.citrus.message.DefaultMessage; | ||
import com.consol.citrus.message.Message; | ||
import com.consol.citrus.util.TestUtils; | ||
import org.mockito.Mockito; | ||
import org.mockito.invocation.InvocationOnMock; | ||
import org.mockito.stubbing.Answer; | ||
|
@@ -109,7 +110,7 @@ public Message answer(InvocationOnMock invocation) throws Throwable { | |
Assert.assertEquals(message.getHeader(CitrusMailMessageHeaders.MAIL_BCC), ""); | ||
Assert.assertEquals(message.getHeader(CitrusMailMessageHeaders.MAIL_REPLY_TO), "[email protected]"); | ||
|
||
// compare the Date as a Date rather than a String, otherwsie this test fails outside of the | ||
// compare the Date as a Date rather than a String, otherwise this test fails outside of the | ||
// "+1" timezone | ||
Date actualDate = dateFormat.parse((String)message.getHeader(CitrusMailMessageHeaders.MAIL_DATE)); | ||
Date expectedDateDate = dateFormat.parse("2006-10-26T13:10:50+0200"); | ||
|
@@ -119,8 +120,8 @@ public Message answer(InvocationOnMock invocation) throws Throwable { | |
Assert.assertEquals(message.getHeader(CitrusMailMessageHeaders.MAIL_CONTENT_TYPE), "multipart/mixed"); | ||
|
||
try { | ||
Assert.assertEquals(StringUtils.trimAllWhitespace(message.getPayload(String.class)), | ||
StringUtils.trimAllWhitespace(FileCopyUtils.copyToString(new InputStreamReader(new ClassPathResource("multipart_mail.xml", | ||
Assert.assertEquals(TestUtils.normalizeLineEndings(message.getPayload(String.class)), | ||
TestUtils.normalizeLineEndings(FileCopyUtils.copyToString(new InputStreamReader(new ClassPathResource("multipart_mail.xml", | ||
MailServer.class).getInputStream())))); | ||
} catch (IOException e) { | ||
Assert.fail(e.getMessage()); | ||
|
@@ -364,8 +365,8 @@ public Message answer(InvocationOnMock invocation) throws Throwable { | |
Assert.assertEquals(message.getHeader(CitrusMailMessageHeaders.MAIL_FILENAME), "index.html"); | ||
|
||
try { | ||
Assert.assertEquals(StringUtils.trimAllWhitespace(message.getPayload(String.class)), | ||
StringUtils.trimAllWhitespace(FileCopyUtils.copyToString(new InputStreamReader(new ClassPathResource("multipart_mail_2.xml", | ||
Assert.assertEquals(TestUtils.normalizeLineEndings(message.getPayload(String.class)), | ||
TestUtils.normalizeLineEndings(FileCopyUtils.copyToString(new InputStreamReader(new ClassPathResource("multipart_mail_2.xml", | ||
MailServer.class).getInputStream())))); | ||
} catch (IOException e) { | ||
Assert.fail(e.getMessage()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
runtime/citrus-testng/src/main/java/com/consol/citrus/testng/TestNGUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.consol.citrus.testng; | ||
|
||
import org.testng.SkipException; | ||
|
||
/** | ||
* @author Thorsten Schlathoelter | ||
*/ | ||
public class TestNGUtils { | ||
|
||
/** | ||
* Skip a test depending on operating system | ||
* @param os | ||
* @param reasonForSkip | ||
*/ | ||
public static void skipForOs(String os, String reasonForSkip) { | ||
if (System.getProperty("os.name").toLowerCase().contains(os.toLowerCase())) { | ||
throw new SkipException(reasonForSkip); | ||
} | ||
} | ||
} |
Oops, something went wrong.