Skip to content

Commit

Permalink
WIP test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stempler committed Mar 11, 2024
1 parent b4d532b commit 1106a19
Showing 1 changed file with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,16 @@ class DefaultMergeCellMigratorTest extends AbstractMergeCellMigratorTest {
assertEquals(expectedFilter, filter.filterTerm)
}

@CompileStatic(TypeCheckingMode.SKIP)
private void filterCheckNull(Cell migrated) {
JaxbAlignmentIO.printCell(migrated, System.out)

// the condition should be present on the source
def source = CellUtil.getFirstEntity(migrated.source).definition
def filter = source.propertyPath.empty ? source.filter : source.propertyPath[0].condition?.filter
assertNull(filter)
}

@Test
void testTypeFilter1() {
def toMigrate = this.class.getResource('/testcases/type-filter/B-to-C.halex')
Expand Down Expand Up @@ -481,13 +491,18 @@ class DefaultMergeCellMigratorTest extends AbstractMergeCellMigratorTest {

// filter
assertEquals(1, migrated.size())
filterCheck(migrated[0], "bb = 'test'") // the filter should be retained
// filter is now dropped (because bb is not mapped for B2)
filterCheckNull(migrated[0])
// filterCheck(migrated[0], "bb = 'test'") // the filter should be retained

// there should be a message about the condition
def messages = getMigrationMessages(migrated[0])
assertTrue(messages.any { msg ->
msg.text.toLowerCase().contains('condition')
})
assertTrue(messages.any { msg ->
msg.text.toLowerCase().contains('removed because no matches')
})
}

@Test
Expand Down

0 comments on commit 1106a19

Please sign in to comment.