-
Notifications
You must be signed in to change notification settings - Fork 2
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
d96df51
commit fe71d01
Showing
22 changed files
with
336 additions
and
165 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
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
65 changes: 40 additions & 25 deletions
65
common/model/src/test/java/net/twisterrob/blt/model/LineTest.java
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
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
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
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
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
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
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
50 changes: 50 additions & 0 deletions
50
.../twisterrob/travel/statushistory/controller/LineStatusHistoryControllerIntegrationTest.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,50 @@ | ||
package net.twisterrob.travel.statushistory.controller | ||
|
||
import io.micronaut.http.HttpRequest | ||
import io.micronaut.http.client.BlockingHttpClient | ||
import io.micronaut.test.annotation.MockBean | ||
import io.micronaut.test.extensions.junit5.annotation.MicronautTest | ||
import jakarta.inject.Inject | ||
import net.twisterrob.blt.data.StaticData | ||
import net.twisterrob.blt.model.LineColors | ||
import net.twisterrob.travel.domain.london.status.api.HistoryUseCase | ||
import org.hamcrest.MatcherAssert.assertThat | ||
import org.hamcrest.Matchers.endsWith | ||
import org.hamcrest.Matchers.startsWith | ||
import org.junit.jupiter.api.Assertions.assertNotNull | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.Test | ||
import org.mockito.Mockito.mock | ||
import org.mockito.Mockito.`when` | ||
|
||
/** | ||
* @see LineStatusHistoryController | ||
*/ | ||
@MicronautTest | ||
class LineStatusHistoryControllerIntegrationTest { | ||
|
||
@Inject | ||
lateinit var client: BlockingHttpClient | ||
|
||
@MockBean(HistoryUseCase::class) | ||
val historyUseCase: HistoryUseCase = mock() | ||
|
||
@MockBean(StaticData::class) | ||
val staticData: StaticData = mock() | ||
|
||
private val lineColors: LineColors = mock() | ||
|
||
@BeforeEach fun setUp() { | ||
`when`(staticData.lineColors).thenReturn(lineColors) | ||
} | ||
|
||
@Test fun testEmptyRequest() { | ||
val request: HttpRequest<Unit> = HttpRequest.GET("/LineStatusHistory") | ||
|
||
val body = client.retrieve(request) | ||
|
||
assertNotNull(body) | ||
assertThat(body, startsWith("<!DOCTYPE html>\n<html lang=\"en\">")) | ||
assertThat(body, endsWith("</html>\n")) | ||
} | ||
} |
Oops, something went wrong.