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
@Test | |
fun `should retrieve talks`() { | |
val mockedTalk = mock(Talk::class.java) | |
given(mockedTalk.format).willReturn(IGNITE) | |
given(mockedTalk.duration).willReturn(Duration.ofHours(1)) | |
// this resulted Talk Object is invalid, the source of truth is the duration | |
// but here with mockito we overload the format computation logic | |
given(searchTalks.forTopics(anySet())).willReturn(setOf(mockedTalk)) | |
val recommendTalks = TalksAdvisor(searchTalks, recommendations, profiles) | |
val recommendation = recommendTalks.satisfying(GuestCriteria(setOf(), setOf(IGNITE))) | |
assertThat(recommendation.talks).containsExactly(mockedTalk) //it should have been filtered | |
assertThat(recommendation.talks.first().format).isEqualTo(IGNITE) | |
assertThat(recommendation.talks.first().duration).isEqualTo(Duration.ofHours(1)) | |
//the test is incorrect but will still pass | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment