use of com.github.vase4kin.teamcityapp.buildlist.filter.BuildListFilterImpl in project TeamCityApp by vase4kin.
the class BuildListActivityTest method testUserCanSeeSnackBarIfBuildFiltersHaveBeenApplied.
@Test
public void testUserCanSeeSnackBarIfBuildFiltersHaveBeenApplied() throws Exception {
when(mTeamCityService.listBuilds(anyString(), anyString())).thenReturn(Observable.just(new Builds(0, Collections.<Build>emptyList())));
// Preparing stubbing intent
Intent resultData = new Intent();
BuildListFilter filter = new BuildListFilterImpl();
filter.setFilter(FilterBuildsView.FILTER_CANCELLED);
filter.setBranch("branch");
filter.setPersonal(true);
filter.setPinned(true);
resultData.putExtra(FilterBuildsRouter.EXTRA_FILTER, filter);
Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, resultData);
mActivityRule.launchActivity(null);
// Open build type
onView(withText("build type")).perform(click());
// Set up result stubbing
intending(hasComponent(FilterBuildsActivity.class.getName())).respondWith(result);
// Pressing filter builds toolbar item
onView(withId(R.id.filter_builds)).perform(click());
// Check snack bar text
onView(withText(R.string.text_filters_applied)).check(matches(isDisplayed()));
// Check data was loaded with new filter
verify(mTeamCityService).listBuilds(eq("build_type_id"), eq("canceled:true,branch:name:branch,personal:true,pinned:true,count:10"));
}
use of com.github.vase4kin.teamcityapp.buildlist.filter.BuildListFilterImpl in project TeamCityApp by vase4kin.
the class FilterBuildsPresenterImpl method onFilterFabClick.
@Override
public void onFilterFabClick(int filterType, boolean isPersonal, boolean isPinned) {
BuildListFilter filter = new BuildListFilterImpl();
filter.setFilter(filterType);
filter.setBranch(mBranchesComponentView.getBranchName());
filter.setPersonal(isPersonal);
filter.setPinned(isPinned);
mTracker.trackUserFilteredBuilds();
mRouter.closeOnSuccess(filter);
}
use of com.github.vase4kin.teamcityapp.buildlist.filter.BuildListFilterImpl in project TeamCityApp by vase4kin.
the class BuildDetailsPresenterImpl method onStartBuildListActivityFilteredByBranchEventTriggered.
/**
* {@inheritDoc}
*/
@Override
public void onStartBuildListActivityFilteredByBranchEventTriggered(String branchName) {
String name = mInteractor.getBuildTypeName();
String id = mInteractor.getBuildDetails().getBuildTypeId();
BuildListFilter filter = new BuildListFilterImpl();
filter.setFilter(FilterBuildsView.FILTER_NONE);
filter.setBranch(branchName);
mRouter.startBuildListActivity(name, id, filter);
}
Aggregations