This file contains hidden or 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 SampleTest { | |
lateinit var driver: AppiumDriver<WebElement> | |
val platform = MobilePlatform.ANDROID | |
@Before | |
fun setup() { | |
if (platform == MobilePlatform.ANDROID) { | |
val dir = System.getProperty("user.dir") | |
val path = Paths.get(dir, "apps/hello-appium.apk") |
This file contains hidden or 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 SampleTest { | |
lateinit var driver: AppiumDriver<WebElement> | |
val platform = MobilePlatform.IOS | |
@Before | |
fun setup() { | |
if (platform == MobilePlatform.ANDROID) { | |
val dir = System.getProperty("user.dir") | |
val path = Paths.get(dir, "apps/hello-appium.apk") |
This file contains hidden or 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 net.appsynth.seven.domain | |
import io.reactivex.Completable | |
import io.reactivex.Observable | |
import net.appsynth.seven.models.promotion.PromotionData | |
object UseCase4 | |
fun UseCase4.getPrepaid(): Observable<PromotionData> { | |
TODO() |
This file contains hidden or 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
/** | |
* Pros: | |
* Super simple | |
* | |
* Cons: | |
* You need to [UseCase1.toObservable] and [Observable.blockingFirst] to exit Rx world | |
*/ | |
interface UseCase1<T> { | |
fun toObservable(): Observable<T> | |
} |
This file contains hidden or 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.blacklenspub.android.playground; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.List; | |
public class ListUtil { | |
public static <T> List<T> filter(Iterable<T> source, Predicate<T> predicate) { | |
return filterTo(source, new ArrayList<T>(), predicate); |
This file contains hidden or 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.blacklenspub.android.playground; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.List; | |
public class FilterableArrayList<T> extends ArrayList<T> { | |
public FilterableArrayList(Collection<? extends T> c) { | |
super(c); |
This file contains hidden or 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
public interface Predicate<T> { | |
Boolean check(T element); | |
} |
This file contains hidden or 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
/** | |
* Returns a list containing only elements matching the given [predicate]. | |
*/ | |
public inline fun <T> Iterable<T>.filter(predicate: (T) -> Boolean): List<T> { | |
return filterTo(ArrayList<T>(), predicate) | |
} | |
/** | |
* Appends all elements matching the given [predicate] to the given [destination]. | |
*/ |
This file contains hidden or 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.example.android.testing.notes.notes | |
import com.example.android.testing.notes.data.Note | |
import com.example.android.testing.notes.data.NotesRepository | |
import com.nhaarman.mockito_kotlin.* | |
import org.jetbrains.spek.api.Spek | |
import org.jetbrains.spek.api.dsl.given | |
import org.jetbrains.spek.api.dsl.it | |
import org.jetbrains.spek.api.dsl.on |
This file contains hidden or 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
public class MainActivity extends AppCompatActivity { | |
StringAdapter adapter; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
adapter = new StringAdapter( | |
Arrays.asList("Harry Potter", "Ron Weasley"), |