-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add log messages if the reports are disabled or dry run enabled
Signed-off-by: Andru Stefanescu <als209@cam.ac.uk>
- Loading branch information
Showing
9 changed files
with
98 additions
and
27 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 was deleted.
Oops, something went wrong.
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
32 changes: 32 additions & 0 deletions
32
jgiven-core/src/test/java/com/tngtech/jgiven/impl/TestUtil/JGivenLogHandler.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,32 @@ | ||
package com.tngtech.jgiven.impl.TestUtil; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.logging.Handler; | ||
import java.util.logging.Level; | ||
import java.util.logging.LogRecord; | ||
|
||
public class JGivenLogHandler extends Handler { | ||
static private List<LogRecord> logList = new ArrayList<>(); | ||
|
||
@Override | ||
public void publish(LogRecord record) { | ||
logList.add(record); | ||
} | ||
|
||
@Override | ||
public void flush() { | ||
resetEvents(); | ||
} | ||
|
||
@Override | ||
public void close() throws SecurityException {} | ||
|
||
public static boolean containsLoggingEvent(String message, Level level) { | ||
return logList.stream().anyMatch(logRecord -> logRecord.getMessage().equals(message) | ||
&& logRecord.getLevel().equals(level)); | ||
} | ||
public static void resetEvents() { | ||
logList.clear(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.