Skip to content

Instantly share code, notes, and snippets.

View EricDw's full-sized avatar
🤔
Always Thinking

Eric De Wildt EricDw

🤔
Always Thinking
View GitHub Profile
@EricDw
EricDw / Pipelines.kt
Created November 21, 2018 02:44
A small DSL around Kotlin's Actor Couroutine.
package com.publicmethod.domain.pipelines
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.*
import kotlinx.coroutines.selects.SelectBuilder
import kotlinx.coroutines.selects.select
interface Pipeline<I, O> : SendChannel<I>, ReceiveChannel<O>
open class PipelineBuilder<I, O>(
@EricDw
EricDw / TestingUtils.kt
Created May 4, 2018 11:53
Utility functions to aid in cratfting kotlin JUnit tests.
import org.junit.Assert.assertTrue
fun assertTrueWithMessage(input: Any, expectedOutput: Any, actualOutput: Any) {
assertTrue(
createMessage(input, expectedOutput, actualOutput),
actualOutput == expectedOutput)
}
fun createMessage(input: Any, expectedOutput: Any, actualOutput: Any): String {
return "input was\n $input\n " +