Add fake data test

This commit is contained in:
2020-04-25 19:42:11 +02:00
parent 081e0fca26
commit 89918ac01a
2 changed files with 44 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
import be.vandewalleh.services.ChapterDTO
import be.vandewalleh.services.FullNoteCreateDTO
import be.vandewalleh.services.NotesService
import com.github.javafaker.Faker
import org.junit.jupiter.api.Test
import org.kodein.di.generic.instance
class FakeDataTest {
val notesService by kodein.instance<NotesService>()
@Test
fun addNotes() {
val faker = Faker()
val title = faker.hobbit().quote()
val tags = listOf(
faker.beer().name(),
faker.beer().yeast()
)
val chapters = listOf(
ChapterDTO(
faker.animal().name(),
faker.lorem().paragraph()
),
ChapterDTO(
faker.animal().name(),
faker.lorem().paragraph()
)
)
val note = FullNoteCreateDTO(title, tags, chapters)
notesService.createNote(15, note)
}
}