Search in sources :

Example 1 with BuildTypes

use of com.github.vase4kin.teamcityapp.navigation.api.BuildTypes 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)));
}
Also used : NavigationNode(com.github.vase4kin.teamcityapp.navigation.api.NavigationNode) Project(com.github.vase4kin.teamcityapp.navigation.api.Project) BuildTypes(com.github.vase4kin.teamcityapp.navigation.api.BuildTypes) BuildType(com.github.vase4kin.teamcityapp.navigation.api.BuildType) Projects(com.github.vase4kin.teamcityapp.navigation.api.Projects)

Example 2 with BuildTypes

use of com.github.vase4kin.teamcityapp.navigation.api.BuildTypes 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")));
}
Also used : NavigationNode(com.github.vase4kin.teamcityapp.navigation.api.NavigationNode) Project(com.github.vase4kin.teamcityapp.navigation.api.Project) BuildTypes(com.github.vase4kin.teamcityapp.navigation.api.BuildTypes) BuildType(com.github.vase4kin.teamcityapp.navigation.api.BuildType) Projects(com.github.vase4kin.teamcityapp.navigation.api.Projects) Test(org.junit.Test)

Aggregations

BuildType (com.github.vase4kin.teamcityapp.navigation.api.BuildType)2 BuildTypes (com.github.vase4kin.teamcityapp.navigation.api.BuildTypes)2 NavigationNode (com.github.vase4kin.teamcityapp.navigation.api.NavigationNode)2 Project (com.github.vase4kin.teamcityapp.navigation.api.Project)2 Projects (com.github.vase4kin.teamcityapp.navigation.api.Projects)2 Test (org.junit.Test)1