Skip to content

Commit ca80a56

Browse files
committed
Kotlin version updated
test suit added for the all test cases execution
1 parent 22bc66e commit ca80a56

30 files changed

+227
-62
lines changed

.idea/misc.xml

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/androidTest/java/com/sample/easyprefs/java/rdwr/PrefsTest.java

+7-4
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
import com.sample.easyprefs.java.Const;
77

88
import org.junit.Before;
9+
import org.junit.FixMethodOrder;
910
import org.junit.Test;
1011
import org.junit.runner.RunWith;
12+
import org.junit.runners.MethodSorters;
1113

1214
import java.util.HashSet;
1315
import java.util.Set;
@@ -23,6 +25,7 @@
2325
* See [testing documentation](http://d.android.com/tools/testing).
2426
*/
2527
@RunWith(AndroidJUnit4.class)
28+
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
2629
public class PrefsTest {
2730

2831
private String p1 = "Hello...";
@@ -43,7 +46,7 @@ public void initApp() {
4346
}
4447

4548
@Test
46-
public void testCommitOp() {
49+
public void test1_CommitOp() {
4750
assertTrue(Prefs.write()
4851
.content(Const.SAMPLE_STRING_KEY, p1)
4952
.content(Const.SAMPLE_INT_KEY, p2)
@@ -57,7 +60,7 @@ public void testCommitOp() {
5760
}
5861

5962
@Test
60-
public void testReadCommitOp() {
63+
public void test2_ReadCommitOp() {
6164

6265
String o1 = Prefs.read().content(Const.SAMPLE_STRING_KEY, "");
6366
assertEquals(p1, o1);
@@ -82,7 +85,7 @@ public void testReadCommitOp() {
8285
}
8386

8487
@Test
85-
public void testApplyOp() {
88+
public void test3_ApplyOp() {
8689
Prefs.write()
8790
.content(Const.SAMPLE_STRING_KEY_APPLY, p1)
8891
.content(Const.SAMPLE_INT_KEY_APPLY, p2)
@@ -95,7 +98,7 @@ public void testApplyOp() {
9598
}
9699

97100
@Test
98-
public void testReadApplyOp() {
101+
public void test4_ReadApplyOp() {
99102

100103
String o1 = Prefs.read().content(Const.SAMPLE_STRING_KEY_APPLY, "");
101104
assertEquals(p1, o1);

app/src/androidTest/java/com/sample/easyprefs/kotlin/clr/PrefsClearContextFileTest.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ import io.easyprefs.Prefs
88
import org.junit.Assert.assertEquals
99
import org.junit.Assert.assertTrue
1010
import org.junit.Before
11+
import org.junit.FixMethodOrder
1112
import org.junit.Test
1213
import org.junit.runner.RunWith
14+
import org.junit.runners.MethodSorters
1315

1416
/**
1517
* Instrumented test, which will execute on an Android device.
1618
*
1719
* See [testing documentation](http://d.android.com/tools/testing).
1820
*/
1921
@RunWith(AndroidJUnit4::class)
22+
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
2023
class PrefsClearContextFileTest {
2124

2225
private lateinit var context: Context
@@ -28,15 +31,15 @@ class PrefsClearContextFileTest {
2831
}
2932

3033
@Test
31-
fun testClearCommitOp() {
34+
fun test1_ClearCommitOp() {
3235
assertTrue(Prefs.clear(context, Const.PREF_SAMPLE_FILE).all().commit())
3336

3437
val data = Prefs.read(context, Const.PREF_SAMPLE_FILE).content(Const.SAMPLE_STRING_KEY, "")
3538
assertEquals("", data)
3639
}
3740

3841
@Test
39-
fun testClearApplyOp() {
42+
fun test2_ClearApplyOp() {
4043
Prefs.clear(context, Const.PREF_SAMPLE_FILE).all().apply()
4144

4245
val data = Prefs.read(context,

app/src/androidTest/java/com/sample/easyprefs/kotlin/clr/PrefsClearContextTest.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ import io.easyprefs.Prefs
88
import org.junit.Assert.assertEquals
99
import org.junit.Assert.assertTrue
1010
import org.junit.Before
11+
import org.junit.FixMethodOrder
1112
import org.junit.Test
1213
import org.junit.runner.RunWith
14+
import org.junit.runners.MethodSorters
1315

1416
/**
1517
* Instrumented test, which will execute on an Android device.
1618
*
1719
* See [testing documentation](http://d.android.com/tools/testing).
1820
*/
1921
@RunWith(AndroidJUnit4::class)
22+
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
2023
class PrefsClearContextTest {
2124

2225
private lateinit var context: Context
@@ -28,15 +31,15 @@ class PrefsClearContextTest {
2831
}
2932

3033
@Test
31-
fun testClearCommitOp() {
34+
fun test1_ClearCommitOp() {
3235
assertTrue(Prefs.clear(context).all().commit())
3336

3437
val data = Prefs.read(context).content(Const.SAMPLE_STRING_KEY, "")
3538
assertEquals("", data)
3639
}
3740

3841
@Test
39-
fun testClearApplyOp() {
42+
fun test2_ClearApplyOp() {
4043
Prefs.clear(context).all().apply()
4144

4245
val data = Prefs.read(context).content(Const.SAMPLE_STRING_KEY_APPLY, "")

app/src/androidTest/java/com/sample/easyprefs/kotlin/clr/PrefsClearFileTest.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ import io.easyprefs.Prefs
77
import org.junit.Assert.assertEquals
88
import org.junit.Assert.assertTrue
99
import org.junit.Before
10+
import org.junit.FixMethodOrder
1011
import org.junit.Test
1112
import org.junit.runner.RunWith
13+
import org.junit.runners.MethodSorters
1214

1315
/**
1416
* Instrumented test, which will execute on an Android device.
1517
*
1618
* See [testing documentation](http://d.android.com/tools/testing).
1719
*/
1820
@RunWith(AndroidJUnit4::class)
21+
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
1922
class PrefsClearFileTest {
2023

2124
@Before
@@ -24,15 +27,15 @@ class PrefsClearFileTest {
2427
}
2528

2629
@Test
27-
fun testClearCommitOp() {
30+
fun test1_ClearCommitOp() {
2831
assertTrue(Prefs.clear(Const.PREF_SAMPLE_FILE_2).all().commit())
2932

3033
val data = Prefs.read(Const.PREF_SAMPLE_FILE_2).content(Const.SAMPLE_STRING_KEY, "")
3134
assertEquals("", data)
3235
}
3336

3437
@Test
35-
fun testClearApplyOp() {
38+
fun test2_ClearApplyOp() {
3639
Prefs.clear(Const.PREF_SAMPLE_FILE_2).all().apply()
3740

3841
val data = Prefs.read(Const.PREF_SAMPLE_FILE_2).content(Const.SAMPLE_STRING_KEY_APPLY, "")

app/src/androidTest/java/com/sample/easyprefs/kotlin/clr/PrefsClearTest.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ import io.easyprefs.Prefs
77
import org.junit.Assert.assertEquals
88
import org.junit.Assert.assertTrue
99
import org.junit.Before
10+
import org.junit.FixMethodOrder
1011
import org.junit.Test
1112
import org.junit.runner.RunWith
13+
import org.junit.runners.MethodSorters
1214

1315
/**
1416
* Instrumented test, which will execute on an Android device.
1517
*
1618
* See [testing documentation](http://d.android.com/tools/testing).
1719
*/
1820
@RunWith(AndroidJUnit4::class)
21+
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
1922
class PrefsClearTest {
2023

2124
@Before
@@ -24,15 +27,15 @@ class PrefsClearTest {
2427
}
2528

2629
@Test
27-
fun testClearCommitOp() {
30+
fun test1_ClearCommitOp() {
2831
assertTrue(Prefs.clear().all().commit())
2932

3033
val data = Prefs.read().content(Const.SAMPLE_STRING_KEY, "")
3134
assertEquals("", data)
3235
}
3336

3437
@Test
35-
fun testClearApplyOp() {
38+
fun test2_ClearApplyOp() {
3639
Prefs.clear().all().apply()
3740

3841
val data = Prefs.read().content(Const.SAMPLE_STRING_KEY_APPLY, "")

app/src/androidTest/java/com/sample/easyprefs/kotlin/has/PrefsHasContextFileTest.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ import com.sample.easyprefs.kotlin.Const
77
import io.easyprefs.Prefs
88
import org.junit.Assert.assertTrue
99
import org.junit.Before
10+
import org.junit.FixMethodOrder
1011
import org.junit.Test
1112
import org.junit.runner.RunWith
13+
import org.junit.runners.MethodSorters
1214

1315
/**
1416
* Instrumented test, which will execute on an Android device.
1517
*
1618
* See [testing documentation](http://d.android.com/tools/testing).
1719
*/
1820
@RunWith(AndroidJUnit4::class)
21+
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
1922
class PrefsHasContextFileTest {
2023

2124
private lateinit var context: Context
@@ -27,7 +30,7 @@ class PrefsHasContextFileTest {
2730
}
2831

2932
@Test
30-
fun testHasOp() {
33+
fun test1_HasOp() {
3134
assertTrue(Prefs.has(context, Const.PREF_SAMPLE_FILE).key(Const.SAMPLE_STRING_KEY))
3235
}
3336
}

app/src/androidTest/java/com/sample/easyprefs/kotlin/has/PrefsHasContextTest.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ import com.sample.easyprefs.kotlin.Const
77
import io.easyprefs.Prefs
88
import org.junit.Assert.assertTrue
99
import org.junit.Before
10+
import org.junit.FixMethodOrder
1011
import org.junit.Test
1112
import org.junit.runner.RunWith
13+
import org.junit.runners.MethodSorters
1214

1315
/**
1416
* Instrumented test, which will execute on an Android device.
1517
*
1618
* See [testing documentation](http://d.android.com/tools/testing).
1719
*/
1820
@RunWith(AndroidJUnit4::class)
21+
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
1922
class PrefsHasContextTest {
2023

2124
private lateinit var context: Context
@@ -27,7 +30,7 @@ class PrefsHasContextTest {
2730
}
2831

2932
@Test
30-
fun testHasOp() {
33+
fun test1_HasOp() {
3134
assertTrue(Prefs.has(context).key(Const.SAMPLE_STRING_KEY))
3235
}
3336
}

app/src/androidTest/java/com/sample/easyprefs/kotlin/has/PrefsHasFileTest.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,18 @@ import io.easyprefs.Prefs
77
import org.junit.Assert.assertEquals
88
import org.junit.Assert.assertTrue
99
import org.junit.Before
10+
import org.junit.FixMethodOrder
1011
import org.junit.Test
1112
import org.junit.runner.RunWith
13+
import org.junit.runners.MethodSorters
1214

1315
/**
1416
* Instrumented test, which will execute on an Android device.
1517
*
1618
* See [testing documentation](http://d.android.com/tools/testing).
1719
*/
1820
@RunWith(AndroidJUnit4::class)
21+
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
1922
class PrefsHasFileTest {
2023

2124
@Before
@@ -24,7 +27,7 @@ class PrefsHasFileTest {
2427
}
2528

2629
@Test
27-
fun testHasOp() {
30+
fun test1_HasOp() {
2831
assertTrue(Prefs.has(Const.PREF_SAMPLE_FILE).key(Const.SAMPLE_STRING_KEY))
2932
}
3033
}

app/src/androidTest/java/com/sample/easyprefs/kotlin/has/PrefsHasTest.kt

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@ import com.sample.easyprefs.kotlin.Const
66
import io.easyprefs.Prefs
77
import org.junit.Assert.assertTrue
88
import org.junit.Before
9+
import org.junit.FixMethodOrder
910
import org.junit.Test
1011
import org.junit.runner.RunWith
12+
import org.junit.runners.MethodSorters
1113

1214
/**
1315
* Instrumented test, which will execute on an Android device.
1416
*
1517
* See [testing documentation](http://d.android.com/tools/testing).
1618
*/
1719
@RunWith(AndroidJUnit4::class)
20+
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
1821
class PrefsHasTest {
1922

2023
@Before
@@ -23,7 +26,7 @@ class PrefsHasTest {
2326
}
2427

2528
@Test
26-
fun testHasOp() {
29+
fun test1_HasOp() {
2730
assertTrue(Prefs.has().key(Const.SAMPLE_STRING_KEY))
2831
}
2932
}

app/src/androidTest/java/com/sample/easyprefs/kotlin/rdwr/PrefsContextFileTest.kt

+7-4
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@ import io.easyprefs.Prefs
88
import org.junit.Assert.assertEquals
99
import org.junit.Assert.assertTrue
1010
import org.junit.Before
11+
import org.junit.FixMethodOrder
1112
import org.junit.Test
1213
import org.junit.runner.RunWith
14+
import org.junit.runners.MethodSorters
1315

1416
/**
1517
* Instrumented test, which will execute on an Android device.
1618
*
1719
* See [testing documentation](http://d.android.com/tools/testing).
1820
*/
1921
@RunWith(AndroidJUnit4::class)
22+
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
2023
class PrefsContextFileTest {
2124

2225
private lateinit var context: Context
@@ -36,7 +39,7 @@ class PrefsContextFileTest {
3639
}
3740

3841
@Test
39-
fun testCommitOp() {
42+
fun test1_CommitOp() {
4043
assertTrue(
4144
Prefs.write(context, Const.PREF_SAMPLE_FILE_2)
4245
.content(Const.SAMPLE_STRING_KEY, p1)
@@ -51,7 +54,7 @@ class PrefsContextFileTest {
5154
}
5255

5356
@Test
54-
fun testReadCommitOp() {
57+
fun test2_ReadCommitOp() {
5558

5659
val o1 = Prefs.read(context, Const.PREF_SAMPLE_FILE_2).content(Const.SAMPLE_STRING_KEY, "")
5760
assertEquals(p1, o1)
@@ -76,7 +79,7 @@ class PrefsContextFileTest {
7679
}
7780

7881
@Test
79-
fun testApplyOp() {
82+
fun test3_ApplyOp() {
8083
Prefs.write(context, Const.PREF_SAMPLE_FILE_2)
8184
.content(Const.SAMPLE_STRING_KEY_APPLY, p1)
8285
.content(Const.SAMPLE_INT_KEY_APPLY, p2)
@@ -89,7 +92,7 @@ class PrefsContextFileTest {
8992
}
9093

9194
@Test
92-
fun testReadApplyOp() {
95+
fun test4_ReadApplyOp() {
9396

9497
val o1 = Prefs.read(context,
9598
Const.PREF_SAMPLE_FILE_2

0 commit comments

Comments
 (0)