File tree Expand file tree Collapse file tree
StudyplusAndroidSDK/src/instrumentTest/java/jp/studyplus/android/sdk/test Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package jp .studyplus .android .sdk .test .auth ;
2+
3+ import android .test .ActivityUnitTestCase ;
4+
5+ import jp .studyplus .android .sdk .service .auth .AuthTransit ;
6+ import jp .studyplus .android .sdk .test .mock .MockActivity ;
7+
8+ public class AuthTransitTest extends ActivityUnitTestCase <MockActivity > {
9+
10+ public AuthTransitTest () {
11+ super (MockActivity .class );
12+ }
13+
14+ public void testTransitToStudyplus () {
15+ try {
16+ AuthTransit .from (getActivity ()).startActivity ("dummy_key" , "dummy_key_secret" );
17+ } catch (Exception e ) {
18+ assertTrue (true );
19+ return ;
20+ }
21+ fail ();
22+ }
23+ }
24+
25+
Original file line number Diff line number Diff line change 1+ package jp .studyplus .android .sdk .test .mock ;
2+
3+ import android .app .Activity ;
4+
5+ public class MockActivity extends Activity {
6+ }
Original file line number Diff line number Diff line change 1+ package jp .studyplus .android .sdk .test .service .api ;
2+
3+ import android .test .AndroidTestCase ;
4+
5+ import jp .studyplus .android .sdk .service .api .ApiRequest ;
6+ import jp .studyplus .android .sdk .service .api .StudyplusApi ;
7+ import jp .studyplus .android .sdk .service .auth .AccessTokenNotFound ;
8+ import jp .studyplus .android .sdk .service .studyrecord .StudyRecordBuilder ;
9+ import jp .studyplus .android .sdk .service .studyrecord .StudyRecordPostRequest ;
10+
11+ public class StudyplusApiTest extends AndroidTestCase {
12+
13+ public void testCatchAccessTokenNotFoundException () {
14+ final ApiRequest request = StudyRecordPostRequest .of (new StudyRecordBuilder ().build ());
15+
16+ try {
17+ StudyplusApi .getClient (getContext ()).send (request );
18+ } catch (AccessTokenNotFound e ) {
19+ assertTrue (true );
20+ return ;
21+ }
22+ assertTrue (false );
23+ }
24+ }
You can’t perform that action at this time.
0 commit comments