This repository was archived by the owner on Aug 15, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +28
-9
lines changed
androidTest/java/com/smlnskgmail/jaman/ormlitedatabackup
main/java/com/smlnskgmail/jaman/ormlitedatabackup/logic/ormlite/backup Expand file tree Collapse file tree 5 files changed +28
-9
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,9 @@ before_install:
2525script :
2626 - ./gradlew checkstyle
2727 - ./gradlew cpdCheck
28- - ./gradlew test
2928 - echo no | android create avd --force -n test -t android-22 --abi armeabi-v7a
3029 - emulator -avd test -no-skin -no-audio -no-window &
3130 - android-wait-for-emulator
3231 - adb shell input keyevent 82 &
33- - ./gradlew connectedAndroidTest
32+ - adb logcat &
33+ - ./gradlew -Pandroid.testInstrumentationRunnerArguments.class=com.smlnskgmail.jaman.ormlitedatabackup.TravisCIAndroidTestSuite connectedAndroidTest
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ android {
1010 minSdkVersion 21
1111 targetSdkVersion 29
1212 versionCode 1
13- versionName " 1.0.3 "
13+ versionName " 1.0.4 "
1414
1515 testInstrumentationRunner " androidx.test.runner.AndroidJUnitRunner"
1616 }
Original file line number Diff line number Diff line change 1+ package com .smlnskgmail .jaman .ormlitedatabackup ;
2+
3+ import com .smlnskgmail .jaman .ormlitedatabackup .backup .OrmLiteBackupCheckTest ;
4+ import com .smlnskgmail .jaman .ormlitedatabackup .ui .CreateEventTest ;
5+
6+ import org .junit .runner .RunWith ;
7+ import org .junit .runners .Suite ;
8+
9+ @ RunWith (Suite .class )
10+ @ Suite .SuiteClasses ({
11+ CreateEventTest .class ,
12+ OrmLiteBackupCheckTest .class
13+ })
14+ public class TravisCIAndroidTestSuite {
15+
16+ }
Original file line number Diff line number Diff line change @@ -66,4 +66,4 @@ private File localBackupFile() {
6666 return new File (ormLiteLocalBackupPath .pathAsString ());
6767 }
6868
69- }
69+ }
Original file line number Diff line number Diff line change @@ -50,8 +50,7 @@ public boolean copy() {
5050 try {
5151 inputStream = fromAsStream != null
5252 ? fromAsStream
53- : context .getContentResolver ().openInputStream (
54- Uri .fromFile (new File (from ))
53+ : context .getContentResolver ().openInputStream (Uri .fromFile (new File (from ))
5554 );
5655 File toFile = new File (to );
5756 if (toFile .exists ()) {
@@ -66,7 +65,7 @@ public boolean copy() {
6665
6766 byte [] buffer = new byte [1024 ];
6867 int length ;
69- while ((length = Objects . requireNonNull ( inputStream ) .read (buffer )) > 0 ) {
68+ while ((length = inputStream .read (buffer )) > 0 ) {
7069 outputStream .write (buffer , 0 , length );
7170 }
7271
@@ -77,8 +76,12 @@ public boolean copy() {
7776 return false ;
7877 } finally {
7978 try {
80- Objects .requireNonNull (inputStream ).close ();
81- Objects .requireNonNull (outputStream ).close ();
79+ if (inputStream != null ) {
80+ inputStream .close ();
81+ }
82+ if (outputStream != null ) {
83+ outputStream .close ();
84+ }
8285 } catch (IOException e ) {
8386 L .e (e );
8487 }
You can’t perform that action at this time.
0 commit comments