Skip to content

Commit

Permalink
Fix code style issues
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalijr2 committed Jan 2, 2025
1 parent 90f6ad6 commit 757d93d
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 25 deletions.
9 changes: 6 additions & 3 deletions commons-logging/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Mock loggers for Apache Commons Logging

[Apache Commons Logging][commons-logging] factory with mock loggers backed by [Mockito][].
[Apache Commons Logging][commons-logging] factory with mock loggers
backed by [Mockito][].

> [!WARNING]
> This library does not support _parallel test execution_.
Expand Down Expand Up @@ -43,7 +44,8 @@ See more details at [HelloServiceBasicTest.java](src/it/hello-commons-logging-wo
> [!IMPORTANT]
> Keep in mind that all loggers are initialized only once during the test run.
Therefore, a more complex example cleans the loggers after (or before) each test:
Therefore, a more complex example cleans the loggers after (or before)
each test:

```java
// the static logger instance
Expand Down Expand Up @@ -79,7 +81,8 @@ void names(String name) {

See more details at [HelloServiceFullTest.java](src/it/hello-commons-logging-world/src/test/java/example/hello/HelloServiceFullTest.java)

To avoid manual cleaning of mock loggers you can use the [jUnit extension][junit-extension] for automation:
To avoid manual cleaning of mock loggers you can use
the [jUnit extension][junit-extension] for automation:

```java
@ExtendWith(MockLoggerExtension.class)
Expand Down
8 changes: 5 additions & 3 deletions core/readme.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Logger Keeper and jUnit Extension

The observer pattern is implemented here: cleaners subscribe to notifications from a keeper, who sends
alerts when mock loggers need to be cleaned and reset. Logger factories should implement the cleaner interface and
register themselves with the keeper. The jUnit extension manages the keeper and sends alerts before and after tests.
The observer pattern is implemented here: cleaners subscribe to notifications
from a keeper, who sends alerts when mock loggers need to be cleaned and reset.
Logger factories should implement the cleaner interface and register
themselves with the keeper. The jUnit extension manages the keeper
and sends alerts before and after tests.

[![Java Version][java-version]][jdk-download]
![jUnit Version][junit-version]
Expand Down
9 changes: 6 additions & 3 deletions jdk-platform-logging/readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Mock loggers for JDK Platform Logging

[JDK Platform Logging][jdk-logging] service with mock loggers backed by [Mockito][].
[JDK Platform Logging][jdk-logging] service with mock loggers
backed by [Mockito][].

> [!WARNING]
> This library does not support _parallel test execution_.
Expand Down Expand Up @@ -42,7 +43,8 @@ See more details at [HelloServiceBasicTest.java](src/it/hello-jdk-platform-loggi
> [!IMPORTANT]
> Keep in mind that all loggers are initialized only once during the test run.
Therefore, a more complex example cleans the loggers after (or before) each test:
Therefore, a more complex example cleans the loggers after (or before)
each test:

```java
// the static logger instance
Expand Down Expand Up @@ -78,7 +80,8 @@ void names(String name) {

See more details at [HelloServiceFullTest.java](src/it/hello-jdk-platform-logging-world/src/test/java/example/hello/HelloServiceFullTest.java)

To avoid manual cleaning of mock loggers you can use the [jUnit extension][junit-extension] for automation:
To avoid manual cleaning of mock loggers you can use
the [jUnit extension][junit-extension] for automation:

```java
@ExtendWith(MockLoggerExtension.class)
Expand Down
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Different logging services can be tested using mock loggers backed by [Mockito][
## How to use

The simplest usage example looks like this:

```java
@Test
void helloWorld() {
Expand Down
6 changes: 4 additions & 2 deletions slf4j/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ See more details at [HelloServiceBasicTest.java](src/it/hello-slf4j-world/src/te
> [!IMPORTANT]
> Keep in mind that all loggers are initialized only once during the test run.
Therefore, a more complex example cleans the loggers after (or before) each test:
Therefore, a more complex example cleans the loggers after (or before)
each test:

```java
// the static logger instance
Expand Down Expand Up @@ -79,7 +80,8 @@ void names(String name) {

See more details at [HelloServiceFullTest.java](src/it/hello-slf4j-world/src/test/java/example/hello/HelloServiceFullTest.java)

To avoid manual cleaning of mock loggers you can use the [jUnit extension][junit-extension] for automation:
To avoid manual cleaning of mock loggers you can use
the [jUnit extension][junit-extension] for automation:

```java
@ExtendWith(MockLoggerExtension.class)
Expand Down
23 changes: 15 additions & 8 deletions tinylog-provider/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@

## Foreword

Unlike the traditional approach where each class or even instance has its own named logger,
tinylog uses a singleton logger. And the provider implementation is a bit complicated to check access to the logger.
Unlike the traditional approach where each class or even instance has
its own named logger, tinylog uses a singleton logger.
And the provider implementation is a bit complicated
to check access to the logger.
Therefore, I recommend using the [Writer](../tinylog-writer) for testing.

## How to use
Expand All @@ -31,7 +33,8 @@ Just put a test dependency to your POM:
</dependency>
```

Use the `MockTinylogProvider` annotation to access the mock provider. The simplest usage example looks like this:
Use the `MockTinylogProvider` annotation to access the mock provider.
The simplest usage example looks like this:

```java
@MockTinylogProvider
Expand All @@ -54,7 +57,8 @@ See more details at [HelloServiceBasicTest.java](src/it/hello-tinylog-world/src/
> [!IMPORTANT]
> Keep in mind that the logger is initialized only once during the test run.
Therefore, a more complex example cleans the logger after (or before) each test:
Therefore, a more complex example cleans the logger after (or before)
each test:

```java
// the static logger instance
Expand Down Expand Up @@ -85,7 +89,8 @@ void names(String name) {

See more details at [HelloServiceFullTest.java](src/it/hello-tinylog-world/src/test/java/example/hello/HelloServiceFullTest.java)

To avoid manual cleaning of the mock logger you can use the [jUnit extension][junit-extension] for automation:
To avoid manual cleaning of the mock logger you can use
the [jUnit extension][junit-extension] for automation:

```java
@ExtendWith(MockLoggerExtension.class)
Expand Down Expand Up @@ -143,7 +148,8 @@ See more details at [HelloServiceAnnotationTest.java](src/it/hello-tinylog-world

### LoggingProvider as a parameter

This library can also inject a mock provider instance as a parameter of a test method:
This library can also inject a mock provider instance
as a parameter of a test method:

```java
@ExtendWith({MockLoggerExtension.class,MockTinylogProviderExtension.class})
Expand All @@ -168,8 +174,9 @@ See more details ad [HelloServiceParameterTest.java](src/it/hello-tinylog-world/

### Configuration

If your application is bundled with another tinylog provider and it is present on the test classpath,
use the configuration to specify the use of the mock provider.
If your application is bundled with another tinylog provider,
and it is present on the test classpath, use the configuration
to specify the use of the mock provider.
See [tinylog.properties](src/it/hello-custom-tinylog-world/src/test/resources/tinylog.properties).

[tinylog]: https://tinylog.org/v2/
Expand Down
17 changes: 11 additions & 6 deletions tinylog-writer/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@

## Foreword

Unlike the traditional approach where each class or even instance has its own named logger,
tinylog uses a singleton logger. Keep this in mind when testing logger calls.
Unlike the traditional approach where each class or even instance has
its own named logger, tinylog uses a singleton logger.
Keep this in mind when testing logger calls.

## How to use

Expand All @@ -30,7 +31,8 @@ Just put a test dependency to your POM:
</dependency>
```

Use the `MockTinylogWriter` annotation to access the mock writer. The simplest usage example looks like this:
Use the `MockTinylogWriter` annotation to access the mock writer.
The simplest usage example looks like this:

```java
@MockTinylogWriter
Expand All @@ -51,7 +53,8 @@ See more details at [HelloServiceBasicTest.java](src/it/hello-tinylog-world/src/
> [!IMPORTANT]
> Keep in mind that the writer are initialized only once during the test run.
Therefore, a more complex example cleans the writer after (or before) each test:
Therefore, a more complex example cleans the writer after (or before)
each test:

```java
// the static logger instance
Expand Down Expand Up @@ -83,7 +86,8 @@ void names(String name) {

See more details at [HelloServiceFullTest.java](src/it/hello-tinylog-world/src/test/java/example/hello/HelloServiceFullTest.java)

To avoid manual cleaning of mock writer you can use the [jUnit extension][junit-extension] for automation:
To avoid manual cleaning of mock writer you can use
the [jUnit extension][junit-extension] for automation:

```java
@ExtendWith({MockitoExtension.class, MockLoggerExtension.class})
Expand Down Expand Up @@ -146,7 +150,8 @@ See more details at [HelloServiceAnnotationTest.java](src/it/hello-tinylog-world

### Writer as a parameter

This library can also inject a mock writer instance as a parameter of a test method:
This library can also inject a mock writer instance
as a parameter of a test method:

```java
@ExtendWith({MockLoggerExtension.class,MockTinylogWriterExtension.class})
Expand Down

0 comments on commit 757d93d

Please sign in to comment.