I am testing this feature:
fun findByUsername(username: String): Account {
return accountRepo.findByUsername(username).orElseThrow {
UsernameNotFoundException("Username was not found")
}
}
here is my test
@Test
fun checkFindByUsername() {
val userRegistrationForm = UserRegistrationForm("testUser3", "123", "eee", false)
val user = accountService.createAccount(userRegistrationForm)
assertEquals(accountRepo.findByUsername("").orElseThrow {
UsernameNotFoundException("Username was not found")
}, "Username was not found")
}
what to do to make the test pass? Do you need to use any specific assertion? sorry, understand that stupid question
Aucun commentaire:
Enregistrer un commentaire