ubu
01/26/2020, 2:05 PMChills
01/26/2020, 3:01 PMChills
01/26/2020, 3:05 PMBruno_
01/26/2020, 3:23 PMdata class Progress(val progress: Int, val max: Int)
it's a function param in one of the services and only two more services will ever have to use itchansek
01/26/2020, 3:29 PMChills
01/26/2020, 4:01 PMChills
01/26/2020, 4:44 PMRay Eldath
01/26/2020, 7:01 PMlateinit
, only can be a var
instead of val
. and perhaps companion object
, it's a good idea, but i think the syntax is not very good.(though i think i can't come up with a better design 😶)paulex
01/27/2020, 12:46 AMfun foo(callback){
GlobalScope.launch {
val x = async {//}.await()
callback(x)
}
}
//Test
@Test
`test that we can test`(){
//i should be able to test that callback is called with value x
}
thanksforallthefish
01/27/2020, 8:46 AMclass Test{}
class Another {
fun <E: Any> test2(test: E) = test.test()
fun <E: Any> E.test() =
println(javaClass.simpleName)
}
Another().test2(
Test()
)
prints Test
class Test{}
class Another {
fun <E: Any> test2(test: E) = test.test()
fun <E: Any> E.test() =
println(this.javaClass.simpleName)
}
Another().test2(
Test()
)
prints Test
elect
01/27/2020, 10:33 AMCharArray
from an IntArray
other than .let{ ints -> CharArray(ints.size){ints[it].toChar()}
?steenooo
01/27/2020, 12:57 PMiex
01/27/2020, 1:21 PMfun foo(): Observable<Result<String, String>> =
Observable.just(Success(""))
.onErrorResumeNext { t: Throwable -> Failure("") } // Type mismatch: inferred type is Observable<Result.Success<String>!>! but Observable<Result<String, String>> was expected
// where:
sealed class Result<out T, out E> {
data class Success<out T>(val success: T) : Result<T, Nothing>()
data class Failure<out E>(val error: E) : Result<Nothing, E>()
}
Matsushita Kohei
01/27/2020, 2:45 PMBig Chungus
01/27/2020, 3:21 PMinternal
via gradle or compiler arg?nfrankel
01/27/2020, 4:40 PMChills
01/27/2020, 10:34 PMjimn
01/28/2020, 7:57 AMObaid Jatoi
01/28/2020, 10:14 AMRodrigo Silva
01/28/2020, 1:45 PMGeorgi Naumov
01/28/2020, 2:38 PMKroppeb
01/28/2020, 6:58 PMTommi Reiman
01/28/2020, 8:50 PMSlackbot
01/29/2020, 12:19 AMvictor-mntl
01/29/2020, 7:12 AMWARN: Failed to initialize native filesystem for Windows
java.lang.RuntimeException: Could not find installation home path. Please make sure bin/idea.properties is present in the installation directory.
at <http://org.jetbrains.kotlin.com|org.jetbrains.kotlin.com>.intellij.openapi.application.PathManager.getHomePath(PathManager.java:97) (...)
Looks like a common issue in other projects that is solved using System.setProperty("<http://idea.io|idea.io>.use.fallback", "true")
or System.setProperty("idea.use.native.fs.for.win", "false")
called before KotlinCoreEnvironment.createForProduction
e.g.: https://github.com/arturbosch/detekt/issues/630
Is it something wrong? Anything missing on my side?Ray Eldath
01/29/2020, 7:26 AMluke
01/29/2020, 9:03 AMsuspend fun
only ever return a java/lang/Object
? Can't seem to make it typed.Big Chungus
01/29/2020, 9:21 AMJiri Bruchanov
01/29/2020, 10:31 AMtschuchort
01/29/2020, 1:35 PMtschuchort
01/29/2020, 1:35 PMMike
01/29/2020, 1:43 PMtschuchort
01/29/2020, 2:13 PMnot()
which means you can't verify that an argument is not equal to something with using argWhere { ... }
. MockK's API is completely asinine. Who thought verify(exactly = 1, atLeast = 2)
would be a good idea? MockK also lacks Mockito's check
matcher. And neither seem to allow me to verify that all calls to a function satisfy a predicate. Mockito has verifyAll
of course but that applies to all methods and not just one. So for an n-argument method you end up writing n+1 separate verify
clauses: One to verify the positive case and n to verify the negative case for each argument.Mike
01/29/2020, 2:36 PMPersonally, I don’t recommend this kind of verification because it is too strict: it means that you don’t trust the actual implementation and the test needs to be updated frequently, every time when more interaction is added with the target mock object.
tschuchort
01/29/2020, 2:49 PMverifyNoMoreInteractions
won't work here because it also excludes calls to other methods of the mock. I want to verify: any number of calls to any method except foo
and at least one call to foo
with parameter x
and for all calls to foo
parameter is x
. Or in pseudocode:
val callsToFoo = calls.filter { it.methodName == "foo" }
assert(callsToFoo.all { it.argument == "x" } && callsToFoo.size >= 1)
verify(inverse = true)
and verify(exactly = 0)
. Shouldn't they be the same?Mike
01/29/2020, 2:58 PMinverse = true
and it would ensure that those aren't called. And because of possible parameters, you'll just end up with some equivalencies.//argument matchers can also be written as Java 8 Lambdas
verify(mockedObject).foo(argThat(someString -> someString == "X"));
From: https://javadoc.io/static/org.mockito/mockito-core/3.2.4/org/mockito/Mockito.html#argument_matchersErik
01/29/2020, 4:42 PMverifyNoMoreInteractions
, called confirmVerified
. You can verify that you've verified all recorded interactions with your mocks.tschuchort
01/29/2020, 8:28 PMargThat
instead of not
but it's not really convenientconfirmVerified
wont work because I only want to verify all interactions on one method not on all methodskyleg
01/30/2020, 5:02 AMErik
01/30/2020, 7:42 AMtschuchort
01/30/2020, 12:57 PMMike
01/30/2020, 1:46 PM