Skip to content

Commit

Permalink
renamings
Browse files Browse the repository at this point in the history
  • Loading branch information
abendt committed May 3, 2024
1 parent b31176f commit 83506c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/main/kotlin/demo/ExampleApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ interface ExampleApi {
suspend fun getPerson(): String

@GET("people/1/")
suspend fun getPersonJson(): PersonResponse
suspend fun getPersonSerializable(): PersonResponse

@GET("people/1/")
suspend fun getPersonArrow(): Either<Throwable, PersonResponse>
suspend fun getPersonEither(): Either<Exception, PersonResponse>

@GET("people/1/")
fun getPersonArrow2(): Either<Throwable, PersonResponse>
fun getPersonEitherNonSuspended(): Either<Exception, PersonResponse>

@GET("people/a/")
suspend fun getPersonArrowFailing(): Either<Throwable, PersonResponse>
suspend fun getPersonEitherFailing(): Either<Exception, PersonResponse>

@GET("people/1/")
suspend fun getPersonKtor(): Either<Throwable, HttpResponse>
suspend fun getPersonKtor(): Either<Exception, HttpResponse>
}

@Serializable
Expand Down
10 changes: 5 additions & 5 deletions src/test/kotlin/demo/ExampleApiSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class ExampleApiSpec : StringSpec({
it.httpClient(ktorClient)
}

exampleApi.getPersonJson().let {
exampleApi.getPersonSerializable().let {
it.name shouldBe "Luke Skywalker"
it.birth_year shouldBe "19BBY"
it.films.shouldNotBeEmpty()
Expand All @@ -73,7 +73,7 @@ class ExampleApiSpec : StringSpec({
.converterFactories(ArrowEitherConverterFactory())
}

exampleApi.getPersonArrow().shouldBeRight()
exampleApi.getPersonEither().shouldBeRight()
.let {
it.name shouldBe "Luke Skywalker"
it.birth_year shouldBe "19BBY"
Expand All @@ -100,7 +100,7 @@ class ExampleApiSpec : StringSpec({
.converterFactories(ArrowEitherConverterFactory())
}

exampleApi.getPersonArrow2().shouldBeRight()
exampleApi.getPersonEitherNonSuspended().shouldBeRight()
.let {
it.name shouldBe "Luke Skywalker"
it.birth_year shouldBe "19BBY"
Expand Down Expand Up @@ -166,7 +166,7 @@ class ExampleApiSpec : StringSpec({
.converterFactories(ArrowEitherConverterFactory())
}

exampleApi.getPersonArrowFailing()
exampleApi.getPersonEitherFailing()
.shouldBeLeft()
.let {
it.shouldBeInstanceOf<ClientRequestException>()
Expand Down Expand Up @@ -194,7 +194,7 @@ class ExampleApiSpec : StringSpec({
.converterFactories(ArrowEitherConverterFactory())
}

exampleApi.getPersonArrowFailing()
exampleApi.getPersonEitherFailing()
.shouldBeLeft()
.let {
it.shouldBeInstanceOf<JsonConvertException>()
Expand Down

0 comments on commit 83506c3

Please sign in to comment.