Skip to content

Commit

Permalink
test: add (disabled) test for checking date error messaging #46
Browse files Browse the repository at this point in the history
ohsome-contributions-stats-service: 'Consider introducing 'Jakarta Bean validation' standard '
#46
  • Loading branch information
mmerdes committed Feb 14, 2024
1 parent f645c8b commit 76c1770
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,29 @@ class StatsControllerMVCTests {
}


//TODO: cover all other urls supporting start/end dates
@Disabled("disabled for now, as the validation with proper error messaging is not yet implemented")
@ParameterizedTest
@ValueSource(
strings = [
"/stats/missingmaps?startdate=xxxxx&enddate=2020-10-01T04:00:00Z",
"/stats/missingmaps?startdate=2020-10-01T04:00:00Z&enddate=xxxxx"
]
)
fun `all requests with bad dates throw error`(url: String) {

val expectedErrorMessage = """[{"message":"xxxxxxx","invalidValue":"xxxxx"}]"""

val GET = get(url)


this.mockMvc
.perform(GET)
.andExpect(status().isBadRequest)
.andExpect(content().string(expectedErrorMessage))
}


@Test
fun `stats can be served without explicit timespans`() {
`when`(this.statsService.getStatsForTimeSpan(matches(hashtag), any(), any(), anyList()))
Expand Down

0 comments on commit 76c1770

Please sign in to comment.