Skip to content

Instantly share code, notes, and snippets.

View mirokolodii's full-sized avatar

Myroslav Kolodii mirokolodii

View GitHub Profile
@mirokolodii
mirokolodii / Test.kt
Last active October 18, 2019 07:16
Switch to Kotlin #2.4
Class Test(val someInt: Int)
val test1: Test // warning: no default value, should be initialized
// with non-null value before first use
val test2: Test = null // error: non-nullable type can't hold null value
val test3: Test? = null // valid
@mirokolodii
mirokolodii / Test.kt
Last active October 24, 2019 06:09
Switch to Kotlin #2.3
val someStr1: String? = null // valid statement, notice a question mark after 'String'
val someStr2: String? // warning: no default value assigned. Should be initialized
// with some (nullable or non-nullable) value before its first use
@mirokolodii
mirokolodii / Test.kt
Last active October 18, 2019 07:13
Switch to Kotlin #2.2
val someStr1: String = "" // same as in Java, i.e initialized with empty string
val someStr2: String // warning: no default value assigned. Should be initialized
// with a non-null value before its first use
val someStr3: String = null // error: can't be null
@mirokolodii
mirokolodii / Test.java
Created October 18, 2019 06:21
Switch to Kotlin #2.1
String someStr1 = ""; // initialized with empty string
String someStr2; // by default value of someStr2 is null
@mirokolodii
mirokolodii / gist:fc816d262ac91c344659bde90c0c284e
Created February 11, 2019 15:45
Espresso RecyclerView count test
@Test
public void FilterClickShouldChangeRecyclerViewCount() {
// Get items count before action
RecyclerView recyclerView = mActivityTestRule.getActivity().findViewById(R.id.recycler_view);
int countBefore = Objects.requireNonNull(recyclerView.getAdapter()).getItemCount();
Log.e("count", "Items count before: " + countBefore);
// Perform action
ViewInteraction actionMenuItemView = onView(
allOf(