diff --git a/metacat-functional-tests/src/functionalTest/groovy/com/netflix/metacat/ParentChildRelMetadataServiceSpec.groovy b/metacat-functional-tests/src/functionalTest/groovy/com/netflix/metacat/ParentChildRelMetadataServiceSpec.groovy index c26d4818c..5c9c175a9 100644 --- a/metacat-functional-tests/src/functionalTest/groovy/com/netflix/metacat/ParentChildRelMetadataServiceSpec.groovy +++ b/metacat-functional-tests/src/functionalTest/groovy/com/netflix/metacat/ParentChildRelMetadataServiceSpec.groovy @@ -81,9 +81,12 @@ class ParentChildRelMetadataServiceSpec extends Specification{ def child1 = QualifiedName.ofTable(catalog, database, "c1") def child2 = QualifiedName.ofTable(catalog, database, "c2") def type = "clone"; + + when: service.createParentChildRelation(parent, child1, type) service.createParentChildRelation(parent, child2, type) + then: // Test Parent assert service.getParent(parent) == null @@ -98,7 +101,7 @@ class ParentChildRelMetadataServiceSpec extends Specification{ // Test Child 1 assert child_parent_expected == service.getParent(child1) - assert service.getChildren(child1) == 0 + assert service.getChildren(child1).size() == 0 assert child_parent_expected == service.getParent(child2) assert service.getChildren(child2).size() == 0 @@ -111,7 +114,13 @@ class ParentChildRelMetadataServiceSpec extends Specification{ def child = QualifiedName.ofTable(catalog, database, "c") def type = "clone" service.createParentChildRelation(parent1, child, type) - assertThrows(RuntimeException.class, service.createParentChildRelation(parent2, child, type)) + + when: + service.createParentChildRelation(parent2, child, type) + + then: + def e = thrown(RuntimeException) + e.message == "Cannot have a child table having more than one parent - Child Table: ${catalog}/${database}/c already have a parent Table=${catalog}/${database}/p1" // Test Child def child_parent_expected = new ParentInfo(parent1.toString(), type) @@ -127,8 +136,12 @@ class ParentChildRelMetadataServiceSpec extends Specification{ def grandChild = QualifiedName.ofTable(catalog, database, "gc") def type = "clone" service.createParentChildRelation(parent, child, type) - assertThrows(RuntimeException.class, service.createParentChildRelation(child, grandChild, type)) + when: + service.createParentChildRelation(child, grandChild, type) + + then: + def e = thrown(RuntimeException) // Test Child def child_parent_expected = new ParentInfo(parent.toString(), type) def child_parent_actual = service.getParent(child)