Skip to content

Instantly share code, notes, and snippets.

@RunWith(JUnit4.class)
public class MVVMTest {
private static final String SOME_URL = "SOME_URL";
private static final String USER_PASSWORD = "USER_PASSWORD";
private static final String USER_NAME = "USER_NAME";
private String tweetedTweet;
@Inject
MainViewModel viewModel;
@RunWith(JUnit4.class)
public class MVPTest {
private static final String SOME_URL = "SOME_URL";
private static final String USER_PASSWORD = "USER_PASSWORD";
private static final String USER_NAME = "USER_NAME";
@Inject
MockTweeterActivityPview pView;
public class MockTweeterActivityPview implements TweeterMVPPView {
public String fetchedTweet = null;
public List<String> previousTweets = null;
public boolean setUserButtonTextCalled = false;
public boolean toggleProgressBarCalled = false;
public boolean toggleLoginContainerCalled = false;
public String displayWebpage = null;
public boolean displayToastCalled = false;
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<SomeView
android:id="@+id/epoints_header"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="enterAlways|scroll"
public class MyClass <T extends String> {
@Inject
@Named("MyObject")Object object;
}
@Component(modules = MyModule.class)
public interface MyComponent {
public void inject(MyClass myClass);
}
@Module
public class MyModule {
@Named("MyObject")
@Provides
Object providesMyObject(){
return null;
}
}
@Component(modules = MyModule.class)
public interface MyComponent {
public void inject(MyClass<String> myClass);
}
public class BasePresenter<T extends BasePresenterView> {
private T presenterView;
private UtilityWrapper utilityWrapper;
public BasePresenter() {
utilityWrapper = new UtilityWrapper();
DaggerActivityComponent.builder()
.baseComponent(PSAApplication.getBaseComponent())
.build()
public class UtilityWrapper {
@Inject
Lazy<StringFormatter> lazyStringFormatter;
@Inject
Lazy<Scheduler> lazyMainScheduler;
public StringFormatter getStringFormatter() {
return lazyStringFormatter.get();