File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed
src/test/kotlin/com/adamratzman/spotify/utilities Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ dependencies {
36
36
37
37
compile " com.squareup.moshi:moshi:1.8.0"
38
38
compile " com.squareup.moshi:moshi-kotlin:1.8.0"
39
- compile group : ' org.json' , name : ' json' , version : ' 20190722'
39
+ compile " org.json: json: 20190722"
40
40
41
41
compile " com.google.http-client:google-http-client:1.31.0"
42
42
@@ -53,7 +53,7 @@ dependencies {
53
53
}
54
54
55
55
testCompile " org.junit.jupiter:junit-jupiter-api:$junit_version "
56
- testCompile " org.json:json:20180130 "
56
+ testCompile " com.google.code.gson:gson:2.8.5 "
57
57
testRuntimeOnly " org.junit.jupiter:junit-jupiter-engine:$junit_version "
58
58
}
59
59
Original file line number Diff line number Diff line change
1
+ /* Spotify Web API - Kotlin Wrapper; MIT License, 2019; Original author: Adam Ratzman */
2
+ package com.adamratzman.spotify.utilities
3
+
4
+ import com.adamratzman.spotify.api
5
+ import com.google.gson.Gson
6
+ import org.junit.jupiter.api.Assertions.assertTrue
7
+ import org.junit.jupiter.api.assertDoesNotThrow
8
+ import org.spekframework.spek2.Spek
9
+ import org.spekframework.spek2.style.specification.describe
10
+
11
+ private val gson = Gson ()
12
+
13
+ class JsonTests : Spek ({
14
+ describe("json serialization tests") {
15
+ it("artist serialization") {
16
+ assertDoesNotThrow {
17
+ assertTrue(gson.toJson(api.artists.getArtist("spotify:artist:5WUlDfRSoLAfcVSX1WnrxN").complete()).isNotEmpty())
18
+ }
19
+ }
20
+ it("track serialization") {
21
+ assertDoesNotThrow {
22
+ assertTrue(gson.toJson(api.tracks.getTrack("spotify:track:6kcHg7XL6SKyPNd78daRBL").complete()).isNotEmpty())
23
+ }
24
+ }
25
+ it("album serialization") {
26
+ assertDoesNotThrow {
27
+ println(gson.toJson(api.albums.getAlbum("spotify:album:6ggQNps98xaXMY0OZWevEH").complete()))
28
+ assertTrue(gson.toJson(api.albums.getAlbum("spotify:album:6ggQNps98xaXMY0OZWevEH").complete()).isNotEmpty())
29
+ }
30
+ }
31
+ }
32
+ })
You can’t perform that action at this time.
0 commit comments