com.tyro.oss:log-testing

A simple library for testing log events.

License

License

GroupId

GroupId

com.tyro.oss
ArtifactId

ArtifactId

log-testing
Last Version

Last Version

2.1
Release Date

Release Date

Type

Type

jar
Description

Description

com.tyro.oss:log-testing
A simple library for testing log events.
Project URL

Project URL

https://github.com/tyro/log-testing
Source Code Management

Source Code Management

https://github.com/tyro/log-testing

Download log-testing

How to add to project

<!-- https://jarcasting.com/artifacts/com.tyro.oss/log-testing/ -->
<dependency>
    <groupId>com.tyro.oss</groupId>
    <artifactId>log-testing</artifactId>
    <version>2.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.tyro.oss/log-testing/
implementation 'com.tyro.oss:log-testing:2.1'
// https://jarcasting.com/artifacts/com.tyro.oss/log-testing/
implementation ("com.tyro.oss:log-testing:2.1")
'com.tyro.oss:log-testing:jar:2.1'
<dependency org="com.tyro.oss" name="log-testing" rev="2.1">
  <artifact name="log-testing" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.tyro.oss', module='log-testing', version='2.1')
)
libraryDependencies += "com.tyro.oss" % "log-testing" % "2.1"
[com.tyro.oss/log-testing "2.1"]

Dependencies

compile (6)

Group / Artifact Type Version
org.jetbrains.kotlin : kotlin-stdlib-jdk8 jar 1.3.11
ch.qos.logback : logback-classic Optional jar 1.2.3
log4j : log4j Optional jar 1.2.17
junit : junit Optional jar 4.12
org.junit.jupiter : junit-jupiter-api Optional jar 5.3.2
org.assertj : assertj-core Optional jar 3.8.0

Project Modules

There are no modules declared in this project.

log-testing

Download Build Status License

A simple library for testing log events.

Getting Started

log-testing is available on Maven Central.

<dependency>
    <groupId>com.tyro.oss</groupId>
    <artifactId>log-testing</artifactId>
    <version>2.1</version>
    <scope>test</scope>
</dependency>

A typical test using Logback and JUnit 5 looks like the following. Log4j and JUnit 4 are also supported.

import com.tyro.oss.logtesting.logback.LogbackAssert.Companion.assertThat
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.extension.RegisterExtension
import org.slf4j.LoggerFactory

class ExampleTest {

    private val logger = LoggerFactory.getLogger(ExampleTest::class.java)

    @JvmField
    @RegisterExtension
    val log = LogbackCaptor(ExampleTest::class)

    @Test
    fun `should log message`() {
        logger.info("test message")

        assertThat(log)
                .hasSize(1)
                .hasInfo("test message")
    }
}

Copyright and Licensing

Copyright (C) 2018 Tyro Payments Pty Ltd

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Contributing

See CONTRIBUTING for details.

com.tyro.oss

Tyro. Better business banking.

Versions

Version
2.1
2.0
1.0