-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65d0f31
commit 5565e27
Showing
3 changed files
with
69 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.restaurant.be | ||
|
||
import com.restaurant.be.common.CustomDescribeSpec | ||
import com.restaurant.be.common.IntegrationTest | ||
import io.kotest.assertions.throwables.shouldThrow | ||
import io.kotest.matchers.shouldBe | ||
import io.kotest.matchers.shouldNotBe | ||
import org.springframework.context.ApplicationContextException | ||
|
||
@IntegrationTest | ||
class BeApplicationTest( | ||
context: org.springframework.context.ApplicationContext | ||
) : CustomDescribeSpec() { | ||
|
||
init { | ||
describe("BeApplication") { | ||
it("should load Spring context successfully") { | ||
context shouldNotBe null | ||
} | ||
|
||
it("should have BeApplication bean") { | ||
context.containsBean("beApplication") shouldBe true | ||
} | ||
|
||
it("test") { | ||
shouldThrow<ApplicationContextException> { | ||
main(arrayOf()) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
src/test/kotlin/com/restaurant/be/WebRestControllerTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.restaurant.be | ||
|
||
import io.kotest.core.spec.style.DescribeSpec | ||
import io.kotest.matchers.shouldBe | ||
import io.mockk.every | ||
import io.mockk.mockk | ||
import org.springframework.core.env.Environment | ||
|
||
class WebRestControllerTest : DescribeSpec({ | ||
|
||
val environment = mockk<Environment>() | ||
val controller = WebRestController(environment) | ||
|
||
describe("WebRestController") { | ||
|
||
context("when there is an active profile") { | ||
it("should return the active profile") { | ||
val activeProfile = "test-profile" | ||
every { environment.activeProfiles } returns arrayOf(activeProfile) | ||
|
||
val result = controller.getProfile() | ||
|
||
result shouldBe activeProfile | ||
} | ||
} | ||
|
||
context("when there is no active profile") { | ||
it("should return 'No Active Profile'") { | ||
every { environment.activeProfiles } returns arrayOf() | ||
|
||
val result = controller.getProfile() | ||
|
||
result shouldBe "No Active Profile" | ||
} | ||
} | ||
} | ||
}) |