use of com.github.vase4kin.teamcityapp.buildlist.filter.BuildListFilter 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.BuildListFilter 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.BuildListFilter in project TeamCityApp by vase4kin.
the class BuildListPresenterImpl method loadData.
/**
* {@inheritDoc}
*/
@Override
protected void loadData(@NonNull OnLoadingListener<List<BuildDetails>> loadingListener, boolean update) {
String buildTypeId = mValueExtractor.getId();
BuildListFilter filter = mValueExtractor.getBuildListFilter();
if (filter != null) {
mDataManager.load(buildTypeId, filter, loadingListener, update);
} else {
mDataManager.load(buildTypeId, loadingListener, update);
}
}
use of com.github.vase4kin.teamcityapp.buildlist.filter.BuildListFilter 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);
}
use of com.github.vase4kin.teamcityapp.buildlist.filter.BuildListFilter in project TeamCityApp by vase4kin.
the class FilterBuildsPresenterImplTest method onFilterFabClick.
@Test
public void onFilterFabClick() throws Exception {
when(mBranchesComponentView.getBranchName()).thenReturn("branch");
mPresenter.onFilterFabClick(FilterBuildsView.FILTER_CANCELLED, true, true);
verify(mBranchesComponentView).getBranchName();
verify(mTracker).trackUserFilteredBuilds();
verify(mRouter).closeOnSuccess(mBuildListFilterCaptor.capture());
BuildListFilter capturedFilter = mBuildListFilterCaptor.getValue();
assertThat(capturedFilter.toLocator(), is(equalTo("canceled:true,branch:name:branch,personal:true,pinned:true,count:10")));
}
Aggregations