Skip to content

Commit

Permalink
adds test on duration validation and rename tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rishiranjjan committed Nov 5, 2024
1 parent 11f2bf0 commit 01244d8
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class StepBuilderTest {
}

@Test
fun `build creates a wait step when waitDuration is provided`() {
fun `build creates a wait step when wait duration is provided`() {
val stepBuilder = StepBuilder(TEST_STEP_NAME)
stepBuilder.wait(30)

Expand All @@ -84,6 +84,15 @@ class StepBuilderTest {
)
}

@Test
fun `wait throws exception for invalid duration`() {
val stepBuilder = StepBuilder(TEST_STEP_NAME)

assertThrows<IllegalArgumentException> {
stepBuilder.wait(300)
}
}

@Test
fun `assertions sets assertions properly`() {
val assertionsMock =
Expand Down Expand Up @@ -130,7 +139,7 @@ class StepBuilderTest {
}

@Test
fun `build throws IllegalStateException when both request & waitDuration are null`() {
fun `build throws IllegalStateException when both request & wait duration are null`() {
val requestBuilderMock = Mockito.mock(RequestBuilder::class.java)
whenever(requestBuilderMock.build())
.thenReturn(null)
Expand All @@ -144,7 +153,7 @@ class StepBuilderTest {
}

@Test
fun `build throws IllegalStateException when both request & waitDuration are provided`() {
fun `build throws IllegalStateException when both request & wait duration are provided`() {
val requestBuilderMock = makeRequestBuilderHappyPathMock()
val stepBuilder = StepBuilder(TEST_STEP_NAME, requestBuilderMock)
stepBuilder.request { }
Expand Down

0 comments on commit 01244d8

Please sign in to comment.