All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonTest.com.toxicbakery.logging.BranchTest.kt Maven / Gradle / Ivy

There is a newer version: 1.40.86
Show newest version
package com.toxicbakery.logging

import kotlin.test.*

class BranchTest {

    private lateinit var seedling: TestSeedling
    private lateinit var branch: Branch

    @BeforeTest
    fun setup() {
        seedling = TestSeedling("tag")
        branch = Branch("tag")
        Arbor.sow(seedling)
    }

    @AfterTest
    fun tearDown() {
        Arbor.harvest(seedling)
    }

    @Test
    fun notEqual() {
        assertFalse(branch.equals(null))
    }

    @Test
    fun notEqualWrongType() {
        assertFalse(branch.equals(""))
    }

    @Test
    fun notEqualTag() {
        assertNotEquals(branch, Branch(tag = "test"))
    }

    @Test
    fun equal() {
        assertEquals(branch, branch)
    }

    @Test
    fun hash() {
        assertEquals(branch.hashCode(), "tag".hashCode())
    }

    @Test
    fun emptyTag() {
        val emptyTagBranch = Branch("")
        emptyTagBranch.d("msg")
        assertEquals("${Arbor.DEBUG} tag msg", seedling.log)
    }

    @Test
    fun d() {
        branch.d(Exception())
        assertEquals("${Arbor.DEBUG} tag ", seedling.log)
    }

    @Test
    fun d1() {
        branch.d("msg")
        assertEquals("${Arbor.DEBUG} tag msg", seedling.log)
    }

    @Test
    fun d2() {
        branch.d("msg", arrayOf(""))
        assertEquals("${Arbor.DEBUG} tag msg", seedling.log)
    }

    @Test
    fun d3() {
        branch.d(Exception(), "msg", arrayOf(""))
        assertEquals("${Arbor.DEBUG} tag msg", seedling.log)
    }

    @Test
    fun v() {
        branch.v(Exception())
        assertEquals("${Arbor.VERBOSE} tag ", seedling.log)
    }

    @Test
    fun v1() {
        branch.v("msg")
        assertEquals("${Arbor.VERBOSE} tag msg", seedling.log)
    }

    @Test
    fun v2() {
        branch.v("msg", arrayOf(""))
        assertEquals("${Arbor.VERBOSE} tag msg", seedling.log)
    }

    @Test
    fun v3() {
        branch.v(Exception(), "msg", arrayOf(""))
        assertEquals("${Arbor.VERBOSE} tag msg", seedling.log)
    }

    @Test
    fun i() {
        branch.i(Exception())
        assertEquals("${Arbor.INFO} tag ", seedling.log)
    }

    @Test
    fun i1() {
        branch.i("msg")
        assertEquals("${Arbor.INFO} tag msg", seedling.log)
    }

    @Test
    fun i2() {
        branch.i("msg", arrayOf(""))
        assertEquals("${Arbor.INFO} tag msg", seedling.log)
    }

    @Test
    fun i3() {
        branch.i(Exception(), "msg", arrayOf(""))
        assertEquals("${Arbor.INFO} tag msg", seedling.log)
    }

    @Test
    fun w() {
        branch.w(Exception())
        assertEquals("${Arbor.WARNING} tag ", seedling.log)
    }

    @Test
    fun w1() {
        branch.w("msg")
        assertEquals("${Arbor.WARNING} tag msg", seedling.log)
    }

    @Test
    fun w2() {
        branch.w("msg", arrayOf(""))
        assertEquals("${Arbor.WARNING} tag msg", seedling.log)
    }

    @Test
    fun w3() {
        branch.w(Exception(), "msg", arrayOf(""))
        assertEquals("${Arbor.WARNING} tag msg", seedling.log)
    }

    @Test
    fun e() {
        branch.e(Exception())
        assertEquals("${Arbor.ERROR} tag ", seedling.log)
    }

    @Test
    fun e1() {
        branch.e("msg")
        assertEquals("${Arbor.ERROR} tag msg", seedling.log)
    }

    @Test
    fun e2() {
        branch.e("msg", arrayOf(""))
        assertEquals("${Arbor.ERROR} tag msg", seedling.log)
    }

    @Test
    fun e3() {
        branch.e(Exception(), "msg", arrayOf(""))
        assertEquals("${Arbor.ERROR} tag msg", seedling.log)
    }

    @Test
    fun wtf() {
        branch.wtf(Exception())
        assertEquals("${Arbor.WTF} tag ", seedling.log)
    }

    @Test
    fun wtf1() {
        branch.wtf("msg")
        assertEquals("${Arbor.WTF} tag msg", seedling.log)
    }

    @Test
    fun wtf2() {
        branch.wtf("msg", arrayOf(""))
        assertEquals("${Arbor.WTF} tag msg", seedling.log)
    }

    @Test
    fun wtf3() {
        branch.wtf(Exception(), "msg", arrayOf(""))
        assertEquals("${Arbor.WTF} tag msg", seedling.log)
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy