Add unit tests
diff --git a/log4j-api-kotlin/pom.xml b/log4j-api-kotlin/pom.xml
index d2dd195..c79537a 100644
--- a/log4j-api-kotlin/pom.xml
+++ b/log4j-api-kotlin/pom.xml
@@ -54,6 +54,17 @@
       <scope>test</scope>
     </dependency>
     <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-core</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>
diff --git a/log4j-api-kotlin/src/test/kotlin/org.apache.logging.log4j.kotlin/LoggerCompanionTest.kt b/log4j-api-kotlin/src/test/kotlin/org.apache.logging.log4j.kotlin/LoggerCompanionTest.kt
index c7c9ba0..a661533 100644
--- a/log4j-api-kotlin/src/test/kotlin/org.apache.logging.log4j.kotlin/LoggerCompanionTest.kt
+++ b/log4j-api-kotlin/src/test/kotlin/org.apache.logging.log4j.kotlin/LoggerCompanionTest.kt
@@ -25,6 +25,6 @@
 
   @Test
   fun `Logging from companion logger works!`() {
-    log.debug("This is a debug log.")
+    log.error("This is an error log.")
   }
 }
diff --git a/log4j-api-kotlin/src/test/kotlin/org.apache.logging.log4j.kotlin/LoggerTest.kt b/log4j-api-kotlin/src/test/kotlin/org.apache.logging.log4j.kotlin/LoggerTest.kt
index 8f6ada6..0683150 100644
--- a/log4j-api-kotlin/src/test/kotlin/org.apache.logging.log4j.kotlin/LoggerTest.kt
+++ b/log4j-api-kotlin/src/test/kotlin/org.apache.logging.log4j.kotlin/LoggerTest.kt
@@ -16,13 +16,107 @@
  */
 package org.apache.logging.log4j.kotlin
 
+import com.nhaarman.mockito_kotlin.*
+import org.apache.logging.log4j.Level
+import org.apache.logging.log4j.MarkerManager
+import org.apache.logging.log4j.junit.LoggerContextRule
+import org.apache.logging.log4j.message.DefaultFlowMessageFactory
+import org.apache.logging.log4j.message.MessageFactory2
+import org.apache.logging.log4j.message.ParameterizedMessage
+import org.apache.logging.log4j.message.ParameterizedMessageFactory
+import org.apache.logging.log4j.spi.ExtendedLogger
+import org.junit.Rule
 import org.junit.Test
+import org.mockito.ArgumentMatchers.anyString
+import kotlin.test.assertTrue
+
+data class Custom(val i: Int)
+
+interface Manager {
+  fun fetchValue(): Int
+}
+
+typealias LoggerStubbingFn = KStubbing<ExtendedLogger>.() -> Unit
 
 class LoggerTest {
-  val log = logger()
+  @Rule @JvmField var init = LoggerContextRule("InfoLogger.xml")
+
+  val msg = ParameterizedMessage("msg {}", 17)
+  val entryMsg = DefaultFlowMessageFactory().newEntryMessage(msg)
+  val cseqMsg: CharSequence = StringBuilder().append("cseq msg")
+  val objectMsg = Custom(17)
+  val cause = RuntimeException("cause")
+  val marker = MarkerManager.getMarker("marker")
+  val result = "foo"
+
+  class Fixture(stubbing: LoggerStubbingFn? = null) {
+    val mockLogger = mock<ExtendedLogger> {
+      on { getMessageFactory<MessageFactory2>() } doReturn ParameterizedMessageFactory()
+      if(stubbing != null) stubbing()
+    }
+
+    val manager = mock<Manager> {
+      on { fetchValue() } doReturn 4711
+    }
+  }
 
   @Test
   fun `Logging works!`() {
-    log.debug("This is a debug log.")
+    val f = Fixture {
+      on { isEnabled(Level.ERROR) } doReturn true
+    }
+    whenever(f.mockLogger.isEnabled(Level.ERROR)).thenReturn(true)
+    val logger = FunctionalLogger(f.mockLogger)
+    logger.error("This is an error log.")
+    verify(f.mockLogger).error(anyString())
+  }
+
+  @Test
+  fun `Level fatal enabled with String message`() {
+    val f = Fixture {
+      on { isEnabled(Level.FATAL) } doReturn true
+    }
+    val logger = FunctionalLogger(f.mockLogger)
+    logger.fatal("string msg with value: ${f.manager.fetchValue()}")
+    verify(f.mockLogger).fatal(anyString())
+    verify(f.manager).fetchValue()
+  }
+
+
+  @Test
+  fun `Level fatal disabled with String message`() {
+    // this should fail but it doesn't because unlike Scala, we just delegate, we don't have any extra logic
+    val f = Fixture {
+      on { isEnabled(Level.FATAL) } doReturn false
+    }
+    whenever(f.mockLogger.isEnabled(Level.FATAL)).thenReturn(false)
+    val logger = FunctionalLogger(f.mockLogger)
+    logger.fatal("string msg with value: ${f.manager.fetchValue()}")
+    verify(f.mockLogger).fatal(anyString())
+    verify(f.manager).fetchValue()
+  }
+
+  @Test
+  fun `Lambda functions are evaluated if the level is high enough`() {
+    var count = 0
+    fun lamdaFun(): String {
+      count++
+      return "This should be evaluated."
+    }
+    val log = logger()
+    log.info { lamdaFun() }
+    assertTrue { count == 1 }
+  }
+
+  @Test
+  fun `Lambda functions are not evaluated if the level is low enough`() {
+    var count = 0
+    fun lamdaFun(): String {
+      count++
+      return "This should never be evaluated."
+    }
+    val log = logger()
+    log.debug { lamdaFun() }
+    assertTrue { count == 0 }
   }
 }
diff --git a/log4j-api-kotlin/src/test/resources/log4j2-test.xml b/log4j-api-kotlin/src/test/resources/InfoLogger.xml
similarity index 93%
rename from log4j-api-kotlin/src/test/resources/log4j2-test.xml
rename to log4j-api-kotlin/src/test/resources/InfoLogger.xml
index 4113137..ba3c948 100644
--- a/log4j-api-kotlin/src/test/resources/log4j2-test.xml
+++ b/log4j-api-kotlin/src/test/resources/InfoLogger.xml
@@ -14,8 +14,9 @@
  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.
+
 -->
-<Configuration name="KotlinTests" status="error">
+<Configuration name="KotlinApiTests" status="warn">
   <Appenders>
     <Console name="Console">
       <PatternLayout>
@@ -24,7 +25,7 @@
     </Console>
   </Appenders>
   <Loggers>
-    <Root level="TRACE">
+    <Root level="INFO">
       <AppenderRef ref="Console"/>
     </Root>
   </Loggers>