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
// We are modelling different types of animals. | |
sealed class Animal { | |
// Cats are simple. A cat is a cat. | |
object Cat : Animal() | |
sealed class Dog: Animal() { | |
companion object : Dog() |
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 Wiring { | |
private final Observable<ViewModel> viewModelObservable; | |
Wiring(View view, ActionDispatcher actionDispatcher, Service service, ViewModelScanner viewModelScanner) { | |
viewModelObservable = view.uiEventObservable() | |
.compose(actionDispatcher.uiEventToAction()) | |
.compose(service.actionToResult()) | |
.compose(viewModelScanner.resultToViewModel()); |
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) | |
public class MyActivityTest { | |
@Rule public ActivityTestRule<MyActivity> activityTestRule = new ActivityTestRule<>(MyActivity.class, false, false); | |
private MyApp myApp; | |
@Before public void setup() { | |
myApp = (MyApp) InstrumentationRegistry.getTargetContext().getApplicationContext(); | |
} |
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) | |
public class MyActivityTest { | |
@Rule public ActivityTestRule<MyActivity> activityTestRule = new ActivityTestRule<>(MyActivity.class, false, false); | |
private MyApp myApp; | |
@Before public void setup() { | |
myApp = (MyApp) InstrumentationRegistry.getTargetContext().getApplicationContext(); | |
} |
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
package me.vaughandroid.testutils.rules; | |
import org.joda.time.DateTimeZone; | |
import org.joda.time.tz.Provider; | |
import org.joda.time.tz.UTCProvider; | |
import org.junit.rules.TestRule; | |
import org.junit.runner.Description; | |
import org.junit.runners.model.Statement; | |
/** |
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
#!/usr/bin/expect | |
############################################################## | |
# | |
# KILL-EMULATOR | |
# | |
# Kills an Android emulator which requires authentication. | |
# It works by opening a telnet session and authenticates, before issuing the | |
# kill command. | |
# |
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
@Component(modules=MyModule.class) | |
@ApplicationScope | |
public interface MyComponent { | |
void inject(MyApplication application); | |
} | |
@Module | |
public class MyModule { | |
@Provides @ApplicationScope | |
public String provideString() { |
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
@Component(modules=MyModule.class) | |
@ApplicationScope | |
public interface MyComponent { | |
void inject(MyApplication application); | |
} | |
@Module | |
public class MyModule { | |
@Provides @ApplicationScope |
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
package com.vaughandroid.test.espresso.idlingresources; | |
import android.app.Activity; | |
import android.os.Handler; | |
import android.support.annotation.IdRes; | |
import android.support.annotation.NonNull; | |
import android.support.test.espresso.*; | |
import android.view.View; | |
import java.lang.ref.WeakReference; |