use of com.github.vase4kin.teamcityapp.navigation.api.NavigationNode in project TeamCityApp by vase4kin.
the class Mocks method navigationNode.
/**
* MOCK
*
* @return projects and build type
*/
public static NavigationNode navigationNode() {
Project project = new Project();
project.setName("Project");
project.setDescription("Description");
BuildType buildType = new BuildType();
buildType.setId("build_type_id");
buildType.setName("build type");
return new NavigationNode(new Projects(Collections.singletonList(project)), new BuildTypes(Collections.singletonList(buildType)));
}
use of com.github.vase4kin.teamcityapp.navigation.api.NavigationNode in project TeamCityApp by vase4kin.
the class RootProjectsActivityTest method testUserCanSeeProjectsData.
@Test
public void testUserCanSeeProjectsData() throws Exception {
// Prepare data
Project project = new Project();
project.setName("New project");
project.setDescription("Contains a lof of projects");
BuildType buildType = new BuildType();
buildType.setId("build_type_id");
buildType.setName("Build and run tests");
NavigationNode navigationNode = new NavigationNode(new Projects(Collections.singletonList(project)), new BuildTypes(Collections.singletonList(buildType)));
when(mTeamCityService.listBuildTypes(anyString())).thenCallRealMethod().thenReturn(Observable.just(navigationNode));
mActivityRule.launchActivity(null);
// Checking toolbar title
matchToolbarTitle("Projects");
// Checking projects data
onView(withId(R.id.navigation_recycler_view)).check(hasItemsCount(2));
onView(withRecyclerView(R.id.navigation_recycler_view).atPositionOnView(0, R.id.itemTitle)).check(matches(withText("Project")));
onView(withRecyclerView(R.id.navigation_recycler_view).atPositionOnView(0, R.id.itemSubTitle)).check(matches(withText("Description")));
onView(withRecyclerView(R.id.navigation_recycler_view).atPositionOnView(1, R.id.itemTitle)).check(matches(withText("build type")));
// Click on projects
onView(withText("Project")).perform(click());
// Check toolbar
matchToolbarTitle("Project");
// Check Project data
onView(withId(R.id.navigation_recycler_view)).check(hasItemsCount(2));
onView(withRecyclerView(R.id.navigation_recycler_view).atPositionOnView(0, R.id.itemTitle)).check(matches(withText("New project")));
onView(withRecyclerView(R.id.navigation_recycler_view).atPositionOnView(0, R.id.itemSubTitle)).check(matches(withText("Contains a lof of projects")));
onView(withRecyclerView(R.id.navigation_recycler_view).atPositionOnView(1, R.id.itemTitle)).check(matches(withText("Build and run tests")));
}
Aggregations