Skip to content

Commit

Permalink
Restores lost test
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperancinha committed Dec 20, 2023
1 parent 34d1d00 commit 6fb4103
Showing 1 changed file with 37 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
package org.jesperancinha.std.old.webapp.service

import io.kotest.matchers.nulls.shouldBeNull
import io.kotest.matchers.nulls.shouldNotBeNull
import io.kotest.matchers.shouldBe
import org.jesperancinha.std.old.webapp.model.DetailEntity
import org.jesperancinha.std.old.webapp.repository.DetailRepository
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.data.repository.findByIdOrNull
import org.springframework.test.context.ActiveProfiles

@SpringBootTest
@ActiveProfiles("test")
class DetailLayer2ServiceKotlinTest(

@Autowired
private val detailService: DetailService,

@Autowired
private val detailRepository: DetailRepository,
private val detailRepository: DetailRepository
) {
@BeforeEach
fun setUp() {
Expand All @@ -27,34 +35,34 @@ class DetailLayer2ServiceKotlinTest(

@Test
fun `should ged details by id`() {
// detailController.findDetailById(Integer.valueOf(1))
// .shouldNotBeNull()
// .apply {
// name shouldBe NAME_1
// city.shouldBeNull()
// }
// detailRepository.deleteAll()
// detailRepository.findByIdOrNull(1)
// .shouldBeNull()
// detailController.findDetailById(1)
// .shouldNotBeNull()
// .apply {
// name shouldBe NAME_1
// city.shouldBeNull()
// }
// addOneElement()
// detailRepository.findByIdOrNull(1)
// .shouldNotBeNull()
// .apply {
// name shouldBe NAME_1
// city.shouldBeNull()
// }
// detailRepository.findByIdOrNull(1)
// .shouldNotBeNull()
// .apply {
// name shouldBe NAME_1
// city.shouldBeNull()
// }
detailService.findDetailById(1)
.shouldNotBeNull()
.apply {
name shouldBe NAME_1
city.shouldBeNull()
}
detailRepository.deleteAll()
detailRepository.findByIdOrNull(1)
.shouldBeNull()
detailService.findDetailById(1)
.shouldNotBeNull()
.apply {
name shouldBe NAME_1
city.shouldBeNull()
}
addOneElement()
detailRepository.findByIdOrNull(1)
.shouldNotBeNull()
.apply {
name shouldBe NAME_1
city.shouldBeNull()
}
detailRepository.findByIdOrNull(1)
.shouldNotBeNull()
.apply {
name shouldBe NAME_1
city.shouldBeNull()
}
}

companion object {
Expand Down

0 comments on commit 6fb4103

Please sign in to comment.