File tree 4 files changed +19
-10
lines changed
androidTest/java/ai/pams/android/kotlin
main/java/ai/pams/android/kotlin/utils
test/java/ai/pams/android/kotlin
4 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ dependencies {
43
43
androidTestImplementation ' androidx.test.espresso:espresso-core:3.4.0'
44
44
implementation " org.jetbrains.kotlin:kotlin-reflect:1.7.0"
45
45
implementation ' com.google.firebase:firebase-messaging-ktx:23.0.6'
46
- implementation ' org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.0-native-mt '
46
+ implementation ' org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1 '
47
47
implementation ' com.google.code.gson:gson:2.9.0'
48
48
implementation (' com.github.mrmike:ok2curl:0.7.0' ){
49
49
exclude group :" com.squareup.okhttp3" , module :" okhttp"
@@ -53,4 +53,10 @@ dependencies {
53
53
implementation ' com.github.bumptech.glide:glide:4.13.0'
54
54
annotationProcessor ' com.github.bumptech.glide:compiler:4.13.0'
55
55
implementation ' com.jakewharton.threetenabp:threetenabp:1.2.3'
56
+
57
+ testImplementation ' org.robolectric:robolectric:4.8'
58
+ testImplementation(' org.threeten:threetenbp:1.4.2' ) {
59
+ exclude group : ' com.jakewharton.threetenabp' , module : ' threetenabp'
60
+ }
61
+ testImplementation " androidx.test:core-ktx:1.4.0"
56
62
}
Original file line number Diff line number Diff line change 1
1
package ai.pams.android.kotlin
2
2
3
3
import ai.pams.android.kotlin.flex.parser.FlexParser
4
- import androidx.test.platform.app.InstrumentationRegistry
5
4
import androidx.test.ext.junit.runners.AndroidJUnit4
6
-
5
+ import androidx.test.platform.app.InstrumentationRegistry
6
+ import org.junit.Assert.assertEquals
7
7
import org.junit.Test
8
8
import org.junit.runner.RunWith
9
9
10
- import org.junit.Assert.*
11
-
12
10
/* *
13
11
* Instrumented test, which will execute on an Android device.
14
12
*
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import org.threeten.bp.format.DateTimeFormatter
7
7
class DateUtils {
8
8
companion object {
9
9
10
- fun getDateFormat () = DateTimeFormatter .ofPattern(" yyyy-MM-dd HH:mm:ss" )
10
+ fun getDateFormat () = DateTimeFormatter .ofPattern(" yyyy-MM-dd HH:mm:ss" ).withZone( ZoneId .of( " GMT0 " ))
11
11
12
12
fun hourFromGMT (): Int {
13
13
val now = LocalDateTime .now()
Original file line number Diff line number Diff line change 1
1
package ai.pams.android.kotlin
2
2
3
- import org.junit.Test
4
-
3
+ import ai.pams.android.kotlin.utils.DateUtils
5
4
import org.junit.Assert.*
5
+ import org.junit.Test
6
+ import org.junit.runner.RunWith
7
+ import org.robolectric.RobolectricTestRunner
6
8
7
9
/* *
8
10
* Example local unit test, which will execute on the development machine (host).
9
11
*
10
12
* See [testing documentation](http://d.android.com/tools/testing).
11
13
*/
14
+ @RunWith(RobolectricTestRunner ::class )
12
15
class ExampleUnitTest {
13
16
@Test
14
- fun addition_isCorrect () {
15
- assertEquals(4 , 2 + 2 )
17
+ fun testParseDate () {
18
+ val str = " 2022-06-29 03:53:51"
19
+ val date = DateUtils .localDateTimeFromString(str)
20
+ assertEquals(date.hour, 10 )
16
21
}
17
22
}
You can’t perform that action at this time.
0 commit comments