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 DeviceIdBootable(private val context: Context) : Bootable() { | |
override val key = Keys.DEVICE_ID | |
override val isCritical = true | |
override fun boot() { | |
val preferences = PreferenceManager.getDefaultSharedPreferences(context) | |
if (!preferences.contains("device_id")) { | |
preferences | |
.edit() |
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
object Keys { | |
val DEVICE_ID = single("device_id") | |
} |
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
abstract class Bootable { | |
abstract val key: Key.Single | |
open val dependencies: Key.Multiple = multiple() | |
open val isConcurrent: Boolean = true | |
open val isCritical: Boolean = false | |
@Throws(Throwable::class) | |
abstract fun boot() | |
} |
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
@RunWith(AndroidJUnit4::class) | |
class TestActivityTest { | |
@Rule | |
@JvmField | |
val rule = ActivityTestRule(TestActivity::class.java) | |
val screen = TestActivityScreen() | |
@Test | |
fun 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
class KTextView : KBaseView<KTextView>, TextViewAssertions { | |
constructor(function: ViewBuilder.() -> Unit): super(function) | |
constructor(parent: Matcher<View>, function: ViewBuilder.() -> Unit): super(parent, function) | |
constructor(parent: DataInteraction, function: ViewBuilder.() -> Unit): super(parent, function) | |
} |
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
open class TestActivityScreen: Screen<TestActivityScreen>() { | |
val content: KView = KView { withId(R.id.content) } | |
val map: KView = KView { withId(R.id.map) } | |
val button: KButton = KButton { withId(R.id.button) } | |
val textViewLarge: KTextView = KTextView { | |
withId(R.id.text_view_large) | |
} | |
val textViewSmall: KTextView = KTextView { |
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
@Test | |
fun espressoTest() { | |
screen { hotelName { isVisible() } } | |
} |
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
@Test | |
public void espressoTest() { | |
onView(allOf(allOf(withId(R.id.label_bf_hotelname), | |
isDescendantOfA(withId(R.id.custom_view_trip_review))), | |
isDescendantOfA(withId(R.id.contentView)))) | |
.check(matches(withEffectiveVisibility(View.VISIBLE))); | |
} |
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 SomeClass { | |
companion object: Serializer() { | |
val TAG = "SomeClass" | |
fun create() = SomeClass() | |
} | |
fun doSomething() { | |
serialize(5) | |
} | |
} |
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
open class Serializer { | |
protected fun serialize(obj: Any): String { | |
return obj.toString() | |
} | |
} | |
class SomeClassOne { | |
companion object: Serializer() | |
fun doSomething() { |