Skip to content

Commit

Permalink
Merge pull request #19 from dm-drogeriemarkt/3.5.1-snapshot
Browse files Browse the repository at this point in the history
fix error message
  • Loading branch information
cleaning-agent authored Nov 24, 2023
2 parents 6a10ef5 + 059e51b commit 17724cd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ logCapture.assertLoggedInOrder(
* [Cucumber example](#cucumber-example)
* [Cucumber feature file](#cucumber-feature-file)
* [Changes](#changes)
* [3.6.2](#362)
* [3.6.1](#361)
* [3.6.0](#360)
* [3.5.0](#350)
Expand All @@ -73,7 +74,7 @@ Add log-capture as a test dependency to your project. If you use Maven, add this
<dependency>
<groupId>de.dm.infrastructure</groupId>
<artifactId>log-capture</artifactId>
<version>3.6.1</version>
<version>3.6.2</version>
<scope>test</scope>
</dependency>
```
Expand Down Expand Up @@ -309,6 +310,10 @@ And with MDC logging context

## Changes

### 3.6.2

* Fixed an assertion message concerning captured Exceptions.

### 3.6.1

* Fixed a misleading and wrong assertion message. The assertion itself was correct, but the message always said all matchers did not match when only a subset did not match.
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -29,7 +29,7 @@
</developers>

<properties>
<project.version>3.5.0-SNAPSHOT</project.version>
<project.version>3.6.2-SNAPSHOT</project.version>

<java.version>1.8</java.version>
<lombok.version>1.18.22</lombok.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static String loggedExceptionToString(Optional<LoggedEvent.LoggedExcepti

LoggedEvent.LoggedException loggedException = optionalException.get();

return format("message: \"%s\", message: %s%s",
return format("message: \"%s\", type: %s%s",
loggedException.getMessage(),
loggedException.getType(),
loggedException.getCause().isPresent() ? format(", cause: (%s)", loggedExceptionToString(loggedException.getCause())) : ""
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/com/example/app/ReadableApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ void expectedExceptionFails() {

assertThat(assertionError).hasMessage("Expected log message has occurred, but never with the expected Exception: Level: WARN, Regex: \"oh no!\"" +
lineSeparator() + " expected exception: message (regex): \"a message never used\" type: java.lang.RuntimeException" +
lineSeparator() + " actual exception: message: \"this is illegal\", message: java.lang.IllegalArgumentException, cause: (message: \"never be null!\", message: java.lang.NullPointerException)" +
lineSeparator() + " actual exception: message: \"this is illegal\", type: java.lang.IllegalArgumentException, cause: (message: \"never be null!\", type: java.lang.NullPointerException)" +
lineSeparator());

AssertionError withoutExceptionAssertionError = assertThrows(AssertionError.class,
Expand Down Expand Up @@ -695,7 +695,7 @@ void combinedLogExpectationsOnlyOutputMismatch() {

assertThat(assertionError).hasMessage("Expected log message has occurred, but never with the expected Exception: Level: ERROR, Regex: \"some error\"" +
lineSeparator() + " expected exception: message (regex): \"an exception that was not logged\"" +
lineSeparator() + " actual exception: message: \"an exception that was logged\", message: java.lang.RuntimeException" +
lineSeparator() + " actual exception: message: \"an exception that was logged\", type: java.lang.RuntimeException" +
lineSeparator());
}
}

0 comments on commit 17724cd

Please sign in to comment.