Search in sources :

Example 1 with User

use of com.github.vase4kin.teamcityapp.buildlist.api.User in project TeamCityApp by vase4kin.

the class OverviewFragmentTest method testUserCanSeeCanceledInfoAsUserName.

@Test
public void testUserCanSeeCanceledInfoAsUserName() throws Exception {
    // Prepare mocks
    when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
    mBuild.setCanceledInfo(new CanceledInfo(CANCELED_TIME_STAMP, new User("user.name", null)));
    // 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);
    // Checking Canceled by
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(1, R.id.itemHeader)).check(matches(withText(R.string.build_canceled_by_text)));
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(1, R.id.itemTitle)).check(matches(withText("user.name")));
}
Also used : User(com.github.vase4kin.teamcityapp.buildlist.api.User) Bundle(android.os.Bundle) CanceledInfo(com.github.vase4kin.teamcityapp.buildlist.api.CanceledInfo) Intent(android.content.Intent) Test(org.junit.Test)

Example 2 with User

use of com.github.vase4kin.teamcityapp.buildlist.api.User in project TeamCityApp by vase4kin.

the class OverviewFragmentTest method testUserCanSeeCanceledInfoAsTimeStampOfCancellation.

@Test
public void testUserCanSeeCanceledInfoAsTimeStampOfCancellation() throws Exception {
    // Prepare mocks
    when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
    mBuild.setCanceledInfo(new CanceledInfo(CANCELED_TIME_STAMP, new User("user.name", null)));
    // 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);
    // Checking time stamp
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(2, R.id.itemHeader)).check(matches(withText(R.string.build_cancellation_time_text)));
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(2, R.id.itemTitle)).check(matches(withText("23 Dec 16 15:11")));
}
Also used : User(com.github.vase4kin.teamcityapp.buildlist.api.User) Bundle(android.os.Bundle) CanceledInfo(com.github.vase4kin.teamcityapp.buildlist.api.CanceledInfo) Intent(android.content.Intent) Test(org.junit.Test)

Example 3 with User

use of com.github.vase4kin.teamcityapp.buildlist.api.User in project TeamCityApp by vase4kin.

the class OverviewFragmentTest method testUserCanSeePersonalInfoIfBuildIsPersonal.

@Test
public void testUserCanSeePersonalInfoIfBuildIsPersonal() {
    // Prepare mocks
    when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
    Triggered triggered = new Triggered(TRIGGER_TYPE_USER, null, new User(USER_NAME, null));
    mBuild.setTriggered(triggered);
    mBuild.setPersonal(true);
    // 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();
    Build successBuild = Mocks.successBuild();
    successBuild.setPersonal(true);
    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(5));
    // Checking Personal of
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(5, R.id.itemHeader)).check(matches(withText(R.string.build_personal_text)));
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(5, R.id.itemTitle)).check(matches(withText(USER_NAME)));
}
Also used : Triggered(com.github.vase4kin.teamcityapp.buildlist.api.Triggered) User(com.github.vase4kin.teamcityapp.buildlist.api.User) Bundle(android.os.Bundle) Build(com.github.vase4kin.teamcityapp.buildlist.api.Build) Intent(android.content.Intent) Test(org.junit.Test)

Example 4 with User

use of com.github.vase4kin.teamcityapp.buildlist.api.User in project TeamCityApp by vase4kin.

the class OverviewFragmentTest method testUserCanSeeWhatUserRestartedBuildIfUserHasName.

@Test
public void testUserCanSeeWhatUserRestartedBuildIfUserHasName() {
    // Prepare mocks
    when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
    Triggered triggered = new Triggered(TRIGGER_TYPE_RESTARTED, null, new User(USER_NAME, NAME));
    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(NAME)));
}
Also used : Triggered(com.github.vase4kin.teamcityapp.buildlist.api.Triggered) User(com.github.vase4kin.teamcityapp.buildlist.api.User) Bundle(android.os.Bundle) Intent(android.content.Intent) Test(org.junit.Test)

Example 5 with User

use of com.github.vase4kin.teamcityapp.buildlist.api.User in project TeamCityApp by vase4kin.

the class OverviewFragmentTest method testUserCanSeeCanceledInfoAsUserRealName.

@Test
public void testUserCanSeeCanceledInfoAsUserRealName() throws Exception {
    // Prepare mocks
    when(mTeamCityService.build(anyString())).thenReturn(Observable.just(mBuild));
    mBuild.setCanceledInfo(new CanceledInfo(CANCELED_TIME_STAMP, new User("user.name", "User name")));
    // 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);
    // Checking Canceled by
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(1, R.id.itemHeader)).check(matches(withText(R.string.build_canceled_by_text)));
    onView(withRecyclerView(R.id.overview_recycler_view).atPositionOnView(1, R.id.itemTitle)).check(matches(withText("User name")));
}
Also used : User(com.github.vase4kin.teamcityapp.buildlist.api.User) Bundle(android.os.Bundle) CanceledInfo(com.github.vase4kin.teamcityapp.buildlist.api.CanceledInfo) Intent(android.content.Intent) Test(org.junit.Test)

Aggregations

User (com.github.vase4kin.teamcityapp.buildlist.api.User)10 Test (org.junit.Test)9 Intent (android.content.Intent)8 Bundle (android.os.Bundle)8 Triggered (com.github.vase4kin.teamcityapp.buildlist.api.Triggered)6 CanceledInfo (com.github.vase4kin.teamcityapp.buildlist.api.CanceledInfo)3 Build (com.github.vase4kin.teamcityapp.buildlist.api.Build)2 Agent (com.github.vase4kin.teamcityapp.agents.api.Agent)1 Artifacts (com.github.vase4kin.teamcityapp.artifact.api.Artifacts)1 Changes (com.github.vase4kin.teamcityapp.changes.api.Changes)1 Properties (com.github.vase4kin.teamcityapp.properties.api.Properties)1 TestOccurrences (com.github.vase4kin.teamcityapp.tests.api.TestOccurrences)1 ArrayList (java.util.ArrayList)1