Skip to content

Commit

Permalink
Should insert a book assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperancinha committed Mar 3, 2024
1 parent cb6ed20 commit 2b07fe1
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package org.jesperancinha.smtd.furniture.service

import io.kotest.assertions.any
import io.kotest.matchers.collections.shouldContainAnyOf
import io.kotest.matchers.collections.shouldHaveSize
import io.kotest.matchers.shouldHave
import org.assertj.core.api.Assertions.assertThat
import org.jesperancinha.console.consolerizer.console.ConsolerizerComposer
import org.jesperancinha.smtd.furniture.model.Case
Expand All @@ -19,20 +23,23 @@ open class CaseServiceAspectJTest(

@Test
fun insertCaseStartNonTransactional() {
val case = Case(
id = -1L,
designation = "Book case",
weight = 230
)
try {
caseService.insertCaseStartOneTransactional(
Case(
id = 100L,
designation = "Book case",
weight = 230
)
case
)
} catch (exception: Exception) {
ConsolerizerComposer.outSpace()
.yellow(exception)
.reset()
}

assertThat(caseService.getAll()).hasSize(1);
val all = caseService.getAll()
all.shouldContainAnyOf(case)
all.filter { it.designation == "Book case" }.shouldHaveSize(1)
}
}

0 comments on commit 2b07fe1

Please sign in to comment.