use of com.github.vase4kin.teamcityapp.buildlist.api.Triggered in project TeamCityApp by vase4kin.
the class OverviewFragmentTest method testUserCanSeeWhatUserRestartedBuildIfUserWasDeleted.
@Test
public void testUserCanSeeWhatUserRestartedBuildIfUserWasDeleted() {
// Prepare mocks
when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
Triggered triggered = new Triggered(TRIGGER_TYPE_RESTARTED, null, null);
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(R.string.triggered_deleted_user_text)));
}
use of com.github.vase4kin.teamcityapp.buildlist.api.Triggered in project TeamCityApp by vase4kin.
the class OverviewFragmentTest method testUserCanSeeWhatUserTriggeredBuildIfUserWasDeleted.
@Test
public void testUserCanSeeWhatUserTriggeredBuildIfUserWasDeleted() {
// Prepare mocks
when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
Triggered triggered = new Triggered(TRIGGER_TYPE_USER, null, null);
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_triggered_by_section_text)));
onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(4, R.id.itemTitle)).check(matches(withText(R.string.triggered_deleted_user_text)));
}
use of com.github.vase4kin.teamcityapp.buildlist.api.Triggered in project TeamCityApp by vase4kin.
the class OverviewFragmentTest method testUserCanSeeWhatConfigurationTriggeredBuildIfConfigurationIsDeleted.
@Test
public void testUserCanSeeWhatConfigurationTriggeredBuildIfConfigurationIsDeleted() {
// Prepare mocks
when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
Triggered triggered = new Triggered(TRIGGER_TYPE_BUILD_TYPE, null, null);
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_triggered_by_section_text)));
onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(4, R.id.itemTitle)).check(matches(withText(R.string.triggered_deleted_configuration_text)));
}
use of com.github.vase4kin.teamcityapp.buildlist.api.Triggered in project TeamCityApp by vase4kin.
the class OverviewFragmentTest method testUserCanSeeWhatUserRestartedBuildIfUserHasOnlyUserName.
@Test
public void testUserCanSeeWhatUserRestartedBuildIfUserHasOnlyUserName() {
// Prepare mocks
when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
Triggered triggered = new Triggered(TRIGGER_TYPE_RESTARTED, null, new User(USER_NAME, null));
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(USER_NAME)));
}
Aggregations