Android Open Source - StudySpaces Room Details Activity Test






From Project

Back to project page StudySpaces.

License

The source code is released under:

Apache License

If you think the Android project StudySpaces listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.pennstudyspaces;
/*from w  w w. j ava  2s.  c  om*/
import android.test.ActivityInstrumentationTestCase2;
import com.pennstudyspaces.SearchActivity;

/**
 * This is a simple framework for a test of an Application.  See
 * {@link android.test.ApplicationTestCase ApplicationTestCase} for more information on
 * how to write and extend Application tests.
 * <p/>
 * To run this test, you can type:
 * adb shell am instrument -w \
 * -e class com.pennstudyspaces.SearchActivityTest \
 * com.pennstudyspaces.tests/android.test.InstrumentationTestRunner
 */
public class RoomDetailsActivityTest extends ActivityInstrumentationTestCase2<RoomDetailsActivity> {

    private RoomDetailsActivity mActivity;
    
    public RoomDetailsActivityTest() {
        super("com.pennstudyspaces", RoomDetailsActivity.class);
    }
    
    @Override
    protected void setUp() throws Exception {
        super.setUp();
        mActivity = this.getActivity();
    }
    
    public void testPreconditions() {
        assertNotNull(mActivity);
    }
    
    
    public void testisRouteDisplayed() {
        assertFalse(mActivity.isRouteDisplayed());
    }
    
    public void testboolToString() {
        assertEquals("yes",mActivity.boolToString(true));
        assertEquals("no",mActivity.boolToString(false));
    }
    
    public void testgenerateReserveLink() {
        String expect, generated;
        expect = "http://pennstudyspaces.com/deeplink?date=1-1-1&time_from=0000&time_to=0101&room=1";
        generated = mActivity.generateReserveLink(0, 0, 1, 1, 1, 1, 1, 1);
        assertEquals(expect, generated);
        
        expect = "http://pennstudyspaces.com/deeplink?date=4-5-1991&time_from=1106&time_to=1107&room=1596";
        generated = mActivity.generateReserveLink(11, 6, 11, 7, 4, 5, 1991, 1596);
        assertEquals(expect, generated);
        
        expect = "http://pennstudyspaces.com/deeplink?date=4-20-2012&time_from=0420&time_to=0420&room=10101";
        generated = mActivity.generateReserveLink(4, 20, 4, 20, 4, 20, 2012, 10101);
        assertEquals(expect, generated);
        
        expect = "";
        generated = mActivity.generateReserveLink(-1, -1, -1, -1, -1, -1, -1, -1);
        assertEquals(expect, generated);
    }
    
}




Java Source Code List

com.pennstudyspaces.DataListAdapter.java
com.pennstudyspaces.MainActivityDead.java
com.pennstudyspaces.MainActivityTest.java
com.pennstudyspaces.MainActivity.java
com.pennstudyspaces.MyItemizedOverlay.java
com.pennstudyspaces.PrefsActivity.java
com.pennstudyspaces.RoomDetailsActivityTest.java
com.pennstudyspaces.RoomDetailsActivity.java
com.pennstudyspaces.SearchActivityTest.java
com.pennstudyspaces.SearchActivity.java
com.pennstudyspaces.StudySpacesApplication.java
com.pennstudyspaces.api.ApiRequest.java
com.pennstudyspaces.api.Availability.java
com.pennstudyspaces.api.Building.java
com.pennstudyspaces.api.DataDumpRequest.java
com.pennstudyspaces.api.JsonData.java
com.pennstudyspaces.api.ParamsRequest.java
com.pennstudyspaces.api.RoomKind.java
com.pennstudyspaces.api.Room.java
com.pennstudyspaces.api.StudySpacesData.java