This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.intellij.execution.testframework.sm.runner.SMTRunnerEventsAdapter | |
import com.intellij.execution.testframework.sm.runner.SMTRunnerEventsListener | |
import com.intellij.execution.testframework.sm.runner.SMTestProxy | |
import com.intellij.notification.NotificationGroupManager | |
import com.intellij.openapi.Disposable | |
import com.intellij.openapi.progress.util.ColorProgressBar | |
import com.intellij.openapi.project.Project | |
import com.intellij.openapi.ui.popup.Balloon | |
import com.intellij.openapi.ui.popup.JBPopupFactory |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.gildedrose | |
import com.gildedrose.domain.StockList | |
import com.gildedrose.foundation.magic | |
import com.gildedrose.persistence.* | |
import dev.forkhandles.result4k.Result | |
import dev.forkhandles.result4k.Success | |
import org.jooq.DSLContext | |
import org.junit.jupiter.api.Test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Improving the ergonomics of dual receivers while we wait for | |
// context receivers | |
// This has a method with two receivers | |
class Thing { | |
fun Context.foo(s: String): Int { | |
// pretend it needs a Context for some reason | |
return s.length | |
} | |
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.lang.reflect.Proxy | |
inline fun <reified T> fake(): T = | |
Proxy.newProxyInstance( | |
T::class.java.classLoader, | |
arrayOf(T::class.java) | |
) { _, _, _ -> | |
TODO("not implemented") | |
} as T |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.jupiter.api.Assertions.assertEquals | |
import org.junit.jupiter.api.Test | |
class EitherTests { | |
@Test | |
fun `infers types`() { | |
fun toInt(p: Either<String, Int>): Int = p.fold( | |
{ s -> s.toInt() }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigDecimal | |
fun main() { | |
val s: StringValue = StringValue.of("hello") | |
StringValue("") // ok as no validation | |
val nes: NonEmptyStringValue? = NonEmptyStringValue.of("hello") // nullable as validated | |
// private as validated, would throw if not private | |
// NonEmptyStringValue("") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.jupiter.api.Assertions.* | |
import org.junit.jupiter.api.Test | |
class StringWrapperTests { | |
private val firstName = FirstName("Fred") | |
private val lastName = LastName("Flintstone") | |
@Test fun canAssignSameType() { | |
val doesCompile: FirstName = firstName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.natpryce.Failure | |
import com.natpryce.Result | |
import com.natpryce.Success | |
import com.natpryce.hamkrest.MatchResult | |
import com.natpryce.hamkrest.Matcher | |
import com.natpryce.hamkrest.assertion.assertThat | |
import com.natpryce.hamkrest.equalTo | |
fun <T, E> assertSuccessThat(actual: Result<T, E>, valueMatcher: Matcher<T>) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ResourceStateMonitorTests : JUnit5Minutests { | |
// If these are too expensive to keep recreating | |
companion object { | |
val resourceRepository = InMemoryResourceRepository() | |
val plugin1 = mock<ResourcePlugin>() | |
val plugin2 = mock<ResourcePlugin>() | |
} | |
class Fixture { |
NewerOlder