Jon White
04/02/2018, 10:57 PMburg
04/02/2018, 11:55 PMfrellan
04/03/2018, 5:55 AMconstructor(
title: String,
portions: Int,
sections: List<ClassA>,
sourceUrl: String? = null
)
and this:
constructor(
title: String,
portions: Int,
ingredients: List<ClassB>,
sourceUrl: String? = null
)
Apperently have the same JVM signature, why is that? Can’t it see that ClassA
and ClassB
are two different classes in the list? I did not know that two lists with different content looked the same to the bytecodeaeruhxi
04/03/2018, 9:21 AMRobert White
04/03/2018, 10:05 AMrobstoll
04/03/2018, 11:06 AMspand
04/03/2018, 12:01 PMkotlin.internal
diesieben07
04/03/2018, 12:23 PMziggy42
04/03/2018, 6:57 PM@Test
fun `do something here`() {
}
rednifre
04/03/2018, 7:20 PMfrellan
04/04/2018, 3:43 AMdiesieben07
04/04/2018, 9:03 AMmplacona
04/04/2018, 2:04 PMfun Date.isWeekend() = day == 6 || day == 7
Inside a class. How do I go about unit testing this?jw
04/04/2018, 2:09 PMfun isWeekend(date: Date): Boolean
karelpeeters
04/04/2018, 3:50 PMkarelpeeters
04/04/2018, 3:53 PMlazyGey
is redundant, get
is already lazy.karelpeeters
04/04/2018, 3:55 PMnekoinemo
04/04/2018, 5:59 PMchetsachdeva
04/04/2018, 7:11 PMString
like "0xFF3F51B5"
and I need to use it in button.setBackgroundColor(int: Int)
. I’ve tried Integer.decode(hexString)
and hexString.toInt(radix = 16)
but no success. Looks like there’s an overflow:
https://youtrack.jetbrains.com/issue/KT-4749
Please help. Thanks 🙂v79
04/04/2018, 7:26 PMchetsachdeva
04/04/2018, 7:29 PMhexString.toLong(16).toInt()
meanwhile 👍Eugen Martynov
04/04/2018, 7:47 PMClayton Walker
04/04/2018, 8:02 PMsnowe
04/04/2018, 10:34 PMproperty
object.karelpeeters
04/05/2018, 6:41 AMfield
to access the backing field, not the actual field.ziggy42
04/05/2018, 12:43 PMigor.wojda
04/05/2018, 3:20 PMOpen
and Submitted
issue status on youtrack (Kotlin issue tracker)?Paul Woitaschek
04/05/2018, 8:11 PMadam-mcneilly
04/05/2018, 9:29 PMfun assertNetworkStateType(clazz: Class<*>) { assertTrue(networkState is clazz) }
so that I can call it like assertNetworkStateType(NetworkState.Loading)
but I can't quite figure out what the type of that parameter would be.jakubgruber
04/06/2018, 9:56 AMJSONObject
in Android. Can anyone help me, please?
@Test
fun `create JSON, must not be empty or null`() {
val json = JSONObject()
json.put("name", "value")
assertNotNull(json)
assertEquals("value",json.get("name"))
}
Running above test fails, but I believe it should not. What’s wrong with JSONObject
?jakubgruber
04/06/2018, 9:56 AMJSONObject
in Android. Can anyone help me, please?
@Test
fun `create JSON, must not be empty or null`() {
val json = JSONObject()
json.put("name", "value")
assertNotNull(json)
assertEquals("value",json.get("name"))
}
Running above test fails, but I believe it should not. What’s wrong with JSONObject
?edwardwongtl
04/06/2018, 10:03 AMjson.get("name")
does not give you a string but a JSONObject
or sthjakubgruber
04/06/2018, 10:04 AMjson.get("name")
returns null anywaygildor
04/06/2018, 10:09 AMjakubgruber
04/06/2018, 10:13 AMtestOptions {
unitTests.returnDefaultValues = true
}
gildor
04/06/2018, 10:14 AMjakubgruber
04/06/2018, 10:15 AMgildor
04/06/2018, 10:15 AMunitTests.returnDefaultValues = true
returnDefaultValues = true
in your project, my advice to disable it, otherwise you will get a lot of such hard to understand problemsorg.json:json
to test dependencies and use it instead of platform one, but be careful, version of this library can be different on Android Framewrokjakubgruber
04/06/2018, 10:19 AMreturnDefaultValues = true
is not recommended, I just wanted to quickly test something with OkHttpgildor
04/06/2018, 10:19 AMjakubgruber
04/06/2018, 10:20 AMgildor
04/06/2018, 10:21 AMjakubgruber
04/06/2018, 10:22 AMSignature
header (it can) and can post json (tested elsewhere), it must work 🙂gildor
04/06/2018, 10:24 AM"""{"my":"json", "object": []}"""
jakubgruber
04/06/2018, 10:25 AM