use of com.github.vase4kin.teamcityapp.buildlist.api.CanceledInfo 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.CanceledInfo 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.CanceledInfo 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