Package kotlin.test

Functions for writing tests (in kunit module)

See:
          Description

Property Summary
var
asserter: Asserter
           
 

Function Summary
fun assertEquals(expected: Any, actual: Any, [message: String]): Unit
Asserts that the expected value is equal to the actual value, with an optional message
fun assertFalse(actual: Boolean, [message: String]): Unit
Asserts that the expression is false with an optional message
fun assertNot(block: () -> Boolean): Unit
Asserts that the given block returns false
fun assertNot(message: String, block: () -> Boolean): Unit
Asserts that the given block returns false
fun <T>
assertNotNull(actual: T?, [message: String]): T
Asserts that the expression is not null, with an optional message
fun <T, R>
assertNotNull(actual: T?, [message: String], block: (T) -> R): Unit
Asserts that the expression is not null, with an optional message and a function block to process the not-null value
fun assertNull(actual: Any, [message: String]): Unit
Asserts that the expression is null, with an optional message
fun assertTrue(actual: Boolean, [message: String]): Unit
Asserts that the expression is true with an optional message
fun assertTrue(block: () -> Boolean): Unit
Asserts that the given block returns true
fun assertTrue(message: String, block: () -> Boolean): Unit
Asserts that the given block returns true
fun <T>
expect(expected: T, block: () -> T): Unit
Asserts that given function block returns the given expected value
fun <T>
expect(expected: T, message: String, block: () -> T): Unit
Asserts that given function block returns the given expected value and use the given message if it fails
fun fail( [message: String]): Unit
Marks a test as having failed if this point in the execution path is reached, with an optional message
fun fails(block: () -> Unit): Throwable
Asserts that given function block fails by throwing an exception
fun <T>
failsWith(exceptionClass: Class<T>, block: () -> Any): T
Asserts that a block fails with a specific exception being thrown
fun todo(block: () -> Any): Unit
Comments out a block of test code until it is implemented while keeping a link to the code
to implement in your unit test output
 

Package kotlin.test Description

Contents

Function Detail
source

assertEquals


 fun assertEquals(expected: Any, actual: Any,  [message: String]): Unit

Asserts that the expected value is equal to the actual value, with an optional message

source

assertFalse


 fun assertFalse(actual: Boolean,  [message: String]): Unit

Asserts that the expression is false with an optional message

source

assertNot


 fun assertNot(block: () -> Boolean): Unit

Asserts that the given block returns false

source

assertNot


 fun assertNot(message: String, block: () -> Boolean): Unit

Asserts that the given block returns false

source

assertNotNull


 fun <T> assertNotNull(actual: T?,  [message: String]): T

Asserts that the expression is not null, with an optional message

source

assertNotNull


 fun <T, R> assertNotNull(actual: T?,  [message: String], block: (T) -> R): Unit

Asserts that the expression is not null, with an optional message and a function block to process the not-null value

source

assertNull


 fun assertNull(actual: Any,  [message: String]): Unit

Asserts that the expression is null, with an optional message

source

assertTrue


 fun assertTrue(actual: Boolean,  [message: String]): Unit

Asserts that the expression is true with an optional message

source

assertTrue


 fun assertTrue(block: () -> Boolean): Unit

Asserts that the given block returns true

source

assertTrue


 fun assertTrue(message: String, block: () -> Boolean): Unit

Asserts that the given block returns true

source

expect


 fun <T> expect(expected: T, block: () -> T): Unit

Asserts that given function block returns the given expected value

source

expect


 fun <T> expect(expected: T, message: String, block: () -> T): Unit

Asserts that given function block returns the given expected value and use the given message if it fails

source

fail


 fun fail( [message: String]): Unit

Marks a test as having failed if this point in the execution path is reached, with an optional message

source

fails


 fun fails(block: () -> Unit): Throwable

Asserts that given function block fails by throwing an exception

source

failsWith


 fun <T> failsWith(exceptionClass: Class<T>, block: () -> Any): T

Asserts that a block fails with a specific exception being thrown

source

todo


 fun todo(block: () -> Any): Unit

Comments out a block of test code until it is implemented while keeping a link to the code
to implement in your unit test output



Copyright © 2010-2012. All Rights Reserved.