Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,10 @@ import io.kotest.property.checkAll
import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test
import kotlin.test.assertTrue

/**
* Property 20: Checklist generation for valid travel parameters
*
* For any TravelParameters with familySize and international destination,
* the checklist always includes passports and visas. Uses the real
* BasicDocumentChecklistGenerator.
*
* **Validates: Requirements 8.6**
*/
@DisplayName("Property 20: Checklist generation")
@Tag("Feature: travel-document-manager, Property 20: Checklist generation")
@DisplayName("Property Test")
class ChecklistGenerationPropertyTest {

private lateinit var generator: BasicDocumentChecklistGenerator
Expand All @@ -42,11 +31,6 @@ class ChecklistGenerationPropertyTest {
generator = BasicDocumentChecklistGenerator()
}

/**
* Generator for TravelParameters with non-null familySize and an international
* destination (origin != destination). This ensures we test the property that
* international travel always includes passports and visas.
*/
private val arbInternationalTravelParams: Arb<TravelParameters> = arbitrary {
val familySize = Arb.int(1..10).bind()
val origin = Arb.element(countries).bind()
Expand All @@ -63,10 +47,6 @@ class ChecklistGenerationPropertyTest {
)
}

/**
* Generator for TravelParameters with origin and destination specified
* (may be same or different) to test the general non-empty checklist property.
*/
private val arbTravelParamsWithOriginAndDestination: Arb<TravelParameters> = arbitrary {
val familySize = Arb.int(1..10).bind()
val origin = Arb.element(countries).bind()
Expand Down Expand Up @@ -107,18 +87,17 @@ class ChecklistGenerationPropertyTest {
fun `generateChecklist always includes passports for international travel`() = runTest {
checkAll(100, arbInternationalTravelParams) { params ->
val checklist = generator.generateChecklist(params)

val passportRequirement = checklist.requiredDocuments.find { it.type == DocumentType.PASSPORT }

assertTrue(
passportRequirement != null,
"Checklist should include passports for international travel " +
"(origin='${params.origin}', destination='${params.destination}')"
)
val pn = requireNotNull(passportRequirement) { "Passport requirement should not be null" }
assertTrue(
passportRequirement!!.countNeeded >= 1,
"Passport countNeeded should be at least 1, " +
"but was ${passportRequirement.countNeeded}"
pn.countNeeded >= 1,
"Passport countNeeded should be at least 1, but was ${pn.countNeeded}"
)
}
}
Expand All @@ -128,41 +107,17 @@ class ChecklistGenerationPropertyTest {
fun `generateChecklist always includes visas for international travel`() = runTest {
checkAll(100, arbInternationalTravelParams) { params ->
val checklist = generator.generateChecklist(params)

val visaRequirement = checklist.requiredDocuments.find { it.type == DocumentType.VISA }

assertTrue(
visaRequirement != null,
"Checklist should include visas for international travel " +
"(origin='${params.origin}', destination='${params.destination}')"
)
val vn = requireNotNull(visaRequirement) { "Visa requirement should not be null" }
assertTrue(
visaRequirement!!.countNeeded >= 1,
"Visa countNeeded should be at least 1, " +
"but was ${visaRequirement.countNeeded}"
)
}
}

@Test
@DisplayName("For international travel with familySize, passports and visas scale by family size")
fun `generateChecklist scales passports and visas by familySize for international travel`() = runTest {
checkAll(100, arbInternationalTravelParams) { params ->
val checklist = generator.generateChecklist(params)
val expectedFamilySize = params.familySize ?: 1

val passportRequirement = checklist.requiredDocuments.find { it.type == DocumentType.PASSPORT }
val visaRequirement = checklist.requiredDocuments.find { it.type == DocumentType.VISA }

assertTrue(
passportRequirement != null && passportRequirement.countNeeded == expectedFamilySize,
"Passport countNeeded should equal familySize ($expectedFamilySize) " +
"but was ${passportRequirement?.countNeeded}"
)
assertTrue(
visaRequirement != null && visaRequirement.countNeeded == expectedFamilySize,
"Visa countNeeded should equal familySize ($expectedFamilySize) " +
"but was ${visaRequirement?.countNeeded}"
vn.countNeeded >= 1,
"Visa countNeeded should be at least 1, but was ${vn.countNeeded}"
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ import org.junit.jupiter.api.Test
*
* **Validates: Requirements 5.8**
*/
@DisplayName("Property 11: Date-range tag generation")
@Tag("Feature: travel-document-manager, Property 11: Date-range tag generation")
@DisplayName("Property Test")
class DateRangeTagPropertyTest {

private lateinit var generator: AutoTagGeneratorImpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ import org.junit.jupiter.api.Test
*
* **Validates: Requirements 5.7**
*/
@DisplayName("Property 10: Destination tag generation")
@Tag("Feature: travel-document-manager, Property 10: Destination tag generation")
@DisplayName("Property Test")
class DestinationTagPropertyTest {

private lateinit var generator: AutoTagGeneratorImpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ import org.junit.jupiter.api.Test
*
* **Validates: Requirements 5.2, 5.3, 5.4, 5.5, 5.6**
*/
@DisplayName("Property 9: Document type to tag mapping")
@Tag("Feature: travel-document-manager, Property 9: Document type to tag mapping")
@DisplayName("Property Test")
class DocumentTypeToTagMappingPropertyTest {

private lateinit var autoTagGenerator: AutoTagGeneratorImpl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import kotlin.test.assertTrue
*
* **Validates: Requirements 8.7**
*/
@DisplayName("Property 21: Family size scaling")
@Tag("Feature: travel-document-manager, Property 21: Family size scaling")
@DisplayName("Property Test")
class FamilySizeScalingPropertyTest {

private lateinit var generator: BasicDocumentChecklistGenerator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Tag as JUnitTag
import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
Expand All @@ -28,8 +27,8 @@ import kotlin.test.assertTrue
*
* **Validates: Requirements 6.6**
*/
@DisplayName("Property 16: Global tag deletion removes from all documents")
@JUnitTag("Feature: travel-document-manager, Property 16: Global tag deletion removes from all documents")
@DisplayName("Property Test")
// Removed JUnitTag - invalid syntax
class GlobalTagDeletionPropertyTest {

private lateinit var documentTagDao: DocumentTagDao
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import io.kotest.property.checkAll
import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Tag as JUnitTag
import org.junit.jupiter.api.Test
import java.time.Instant
import kotlin.test.assertTrue
Expand All @@ -28,8 +27,8 @@ import kotlin.test.assertTrue
*
* **Validates: Requirements 9.1, 9.6**
*/
@DisplayName("Property 23: Missing document detection")
@JUnitTag("Feature: travel-document-manager, Property 23: Missing document detection")
@DisplayName("Property Test")
// Removed JUnitTag - invalid syntax
class MissingDocDetectionPropertyTest {

private lateinit var generator: BasicDocumentChecklistGenerator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ import io.kotest.property.checkAll
import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Tag as JUnitTag
import org.junit.jupiter.api.Test
import java.time.Instant
import kotlin.test.assertTrue

/**
* Property 24: Every missing document has a non-empty actionable suggestion
*/
@DisplayName("Property 24: Missing document suggestions")
@JUnitTag("Feature: travel-document-manager, Property 24: Missing document suggestions")
@DisplayName("Property Test")
// Removed JUnitTag - invalid syntax
class MissingDocSuggestionsPropertyTest {

private lateinit var generator: BasicDocumentChecklistGenerator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import io.kotest.property.checkAll
import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Tag as JUnitTag
import org.junit.jupiter.api.Test
import java.time.Instant
import kotlin.test.assertEquals
Expand All @@ -29,8 +28,8 @@ import kotlin.test.assertTrue
*
* **Validates: Requirements 9.5, 9.6, 9.7**
*/
@DisplayName("Property 21: Missing document detection")
@JUnitTag("Feature: travel-document-manager, Property 21: Missing document detection")
@DisplayName("Property Test")
// Removed JUnitTag - invalid syntax
class MissingDocumentDetectionPropertyTest {

private lateinit var generator: BasicDocumentChecklistGenerator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Tag as JUnitTag
import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
Expand All @@ -27,8 +26,8 @@ import kotlin.test.assertTrue
*
* **Validates: Requirements 6.2**
*/
@DisplayName("Property 13: Adding a tag grows the tag list")
@JUnitTag("Feature: travel-document-manager, Property 13: Adding a tag grows the tag list")
@DisplayName("Property Test")
// Removed JUnitTag - invalid syntax
class TagAddGrowsListPropertyTest {

private lateinit var documentTagDao: DocumentTagDao
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Tag as JUnitTag
import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
Expand All @@ -29,8 +28,8 @@ import kotlin.test.assertTrue
*
* **Validates: Requirements 6.4**
*/
@DisplayName("Property 15: Tag deduplication (idempotence)")
@JUnitTag("Feature: travel-document-manager, Property 15: Tag deduplication (idempotence)")
@DisplayName("Property Test")
// Removed JUnitTag - invalid syntax
class TagDeduplicationPropertyTest {

private lateinit var documentTagDao: DocumentTagDao
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import kotlinx.coroutines.test.runTest
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.Tag as JUnitTag
import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
import kotlin.test.assertFalse
Expand All @@ -29,8 +28,8 @@ import kotlin.test.assertTrue
*
* **Validates: Requirements 6.3**
*/
@DisplayName("Property 14: Removing a tag shrinks the tag list")
@JUnitTag("Feature: travel-document-manager, Property 14: Removing a tag shrinks the tag list")
@DisplayName("Property Test")
// Removed JUnitTag - invalid syntax
class TagRemoveShrinksListPropertyTest {

private lateinit var documentTagDao: DocumentTagDao
Expand Down
Loading