Skip to content

Instantly share code, notes, and snippets.

View miquelbeltran's full-sized avatar

Miguel Beltran miquelbeltran

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<layout>
<data>
<variable
name="dataSource"
type="com.beltranfebrer.databindingcourse.DataSource"/>
</data>
<com.beltranfebrer.databindingcourse.DataView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:bind="http://schemas.android.com/apk/res-auto"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="dataSource"
type="com.beltranfebrer.databindingcourse.DataSource"/>
<variable
name="includeSource"
type="com.beltranfebrer.databindingcourse.DataSource"/>
@Implements(CollapsingToolbarLayout.class)
public class ShadowCollapsingToolbarLayout extends ShadowFrameLayout {
public void __constructor__(Context context, AttributeSet attrs, int defStyleAttr) {
}
@Implementation
public void onAttachedToWindow() {
public interface ProfileInteractor {
Observable<UserProfile> getProfile();
}
public class ProfileInteractorTest {
private static final String USER = "USERNAME";
ProfileInteractor interactor;
@Before
public void setUp() {
interactor = new ProfileInteractorImpl(...);
}
@Test
public interface ProfileView {
void display(UserProfile userProfile);
}
public class ProfileFrameLayout extends FrameLayout implements ProfileView {
private ProfilePresenter presenter;
@BindView(R.id.text_username)
TextView textUsername;
@Inject
public void setPresenter(ProfilePresenter presenter) {
this.presenter = presenter;
@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class)
public class ProfileFrameLayoutTest {
private ProfileFrameLayout profileView;
@Mock
ProfilePresenter presenter;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
public void ProfilePresenter {
private final ProfileInteractor interactor;
private ProfileView view;
public ProfilePresenter(ProfileInteractor interactor) {
this.interactor = interactor.
}
public void attachView(ProfileView view) {
this.view = view;
public void ProfilePresenterTest {
@Mock
ProfileInteractor interactor;
@Mock
ProfileView view;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
when(interactor.getUserProfile()).thenReturn(Observable.just(new UserProfile()));