use of com.github.vase4kin.teamcityapp.buildlist.api.User in project TeamCityApp by vase4kin.
the class OverviewFragmentTest method testUserCanSeeCanceledInfoAsUserName.
@Test
public void testUserCanSeeCanceledInfoAsUserName() throws Exception {
// Prepare mocks
when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
mBuild.setCanceledInfo(new CanceledInfo(CANCELED_TIME_STAMP, new User("user.name", null)));
// Prepare intent
// <! ---------------------------------------------------------------------- !>
// Passing build object to activity, had to create it for real, Can't pass mock object as serializable in bundle :(
// <! ---------------------------------------------------------------------- !>
Intent intent = new Intent();
Bundle b = new Bundle();
b.putSerializable(BundleExtractorValues.BUILD, Mocks.successBuild());
b.putString(BundleExtractorValues.NAME, BUILD_TYPE_NAME);
intent.putExtras(b);
// Start activity
mActivityRule.launchActivity(intent);
// Checking Canceled by
onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(1, R.id.itemHeader)).check(matches(withText(R.string.build_canceled_by_text)));
onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(1, R.id.itemTitle)).check(matches(withText("user.name")));
}
use of com.github.vase4kin.teamcityapp.buildlist.api.User in project TeamCityApp by vase4kin.
the class OverviewFragmentTest method testUserCanSeeCanceledInfoAsTimeStampOfCancellation.
@Test
public void testUserCanSeeCanceledInfoAsTimeStampOfCancellation() throws Exception {
// Prepare mocks
when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
mBuild.setCanceledInfo(new CanceledInfo(CANCELED_TIME_STAMP, new User("user.name", null)));
// Prepare intent
// <! ---------------------------------------------------------------------- !>
// Passing build object to activity, had to create it for real, Can't pass mock object as serializable in bundle :(
// <! ---------------------------------------------------------------------- !>
Intent intent = new Intent();
Bundle b = new Bundle();
b.putSerializable(BundleExtractorValues.BUILD, Mocks.successBuild());
b.putString(BundleExtractorValues.NAME, BUILD_TYPE_NAME);
intent.putExtras(b);
// Start activity
mActivityRule.launchActivity(intent);
// Checking time stamp
onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(2, R.id.itemHeader)).check(matches(withText(R.string.build_cancellation_time_text)));
onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(2, R.id.itemTitle)).check(matches(withText("23 Dec 16 15:11")));
}
use of com.github.vase4kin.teamcityapp.buildlist.api.User in project TeamCityApp by vase4kin.
the class OverviewFragmentTest method testUserCanSeePersonalInfoIfBuildIsPersonal.
@Test
public void testUserCanSeePersonalInfoIfBuildIsPersonal() {
// Prepare mocks
when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
Triggered triggered = new Triggered(TRIGGER_TYPE_USER, null, new User(USER_NAME, null));
mBuild.setTriggered(triggered);
mBuild.setPersonal(true);
// Prepare intent
// <! ---------------------------------------------------------------------- !>
// Passing build object to activity, had to create it for real, Can't pass mock object as serializable in bundle :(
// <! ---------------------------------------------------------------------- !>
Intent intent = new Intent();
Bundle b = new Bundle();
Build successBuild = Mocks.successBuild();
successBuild.setPersonal(true);
b.putSerializable(BundleExtractorValues.BUILD, Mocks.successBuild());
b.putString(BundleExtractorValues.NAME, BUILD_TYPE_NAME);
intent.putExtras(b);
// Start activity
mActivityRule.launchActivity(intent);
// Scrolling to last item to make it visible
onView(withId(R.id.overview_recycler_view)).perform(scrollToPosition(5));
// Checking Personal of
onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(5, R.id.itemHeader)).check(matches(withText(R.string.build_personal_text)));
onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(5, R.id.itemTitle)).check(matches(withText(USER_NAME)));
}
use of com.github.vase4kin.teamcityapp.buildlist.api.User in project TeamCityApp by vase4kin.
the class OverviewFragmentTest method testUserCanSeeWhatUserRestartedBuildIfUserHasName.
@Test
public void testUserCanSeeWhatUserRestartedBuildIfUserHasName() {
// Prepare mocks
when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
Triggered triggered = new Triggered(TRIGGER_TYPE_RESTARTED, null, new User(USER_NAME, NAME));
mBuild.setTriggered(triggered);
// Prepare intent
// <! ---------------------------------------------------------------------- !>
// Passing build object to activity, had to create it for real, Can't pass mock object as serializable in bundle :(
// <! ---------------------------------------------------------------------- !>
Intent intent = new Intent();
Bundle b = new Bundle();
b.putSerializable(BundleExtractorValues.BUILD, Mocks.successBuild());
b.putString(BundleExtractorValues.NAME, BUILD_TYPE_NAME);
intent.putExtras(b);
// Start activity
mActivityRule.launchActivity(intent);
// Scrolling to last item to make it visible
onView(withId(R.id.overview_recycler_view)).perform(scrollToPosition(4));
// Checking restarted by
onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(4, R.id.itemHeader)).check(matches(withText(R.string.build_restarted_by_section_text)));
onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(4, R.id.itemTitle)).check(matches(withText(NAME)));
}
use of com.github.vase4kin.teamcityapp.buildlist.api.User in project TeamCityApp by vase4kin.
the class OverviewFragmentTest method testUserCanSeeCanceledInfoAsUserRealName.
@Test
public void testUserCanSeeCanceledInfoAsUserRealName() throws Exception {
// Prepare mocks
when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
mBuild.setCanceledInfo(new CanceledInfo(CANCELED_TIME_STAMP, new User("user.name", "User name")));
// Prepare intent
// <! ---------------------------------------------------------------------- !>
// Passing build object to activity, had to create it for real, Can't pass mock object as serializable in bundle :(
// <! ---------------------------------------------------------------------- !>
Intent intent = new Intent();
Bundle b = new Bundle();
b.putSerializable(BundleExtractorValues.BUILD, Mocks.successBuild());
b.putString(BundleExtractorValues.NAME, BUILD_TYPE_NAME);
intent.putExtras(b);
// Start activity
mActivityRule.launchActivity(intent);
// Checking Canceled by
onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(1, R.id.itemHeader)).check(matches(withText(R.string.build_canceled_by_text)));
onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(1, R.id.itemTitle)).check(matches(withText("User name")));
}
Aggregations