package Ġnet . cord a . bn . flows Ċ Ċ import Ġnet . cord a . bn . states . Group State Ċ import Ġnet . cord a . bn . states . Membership State Ċ import Ġnet . cord a . core . contracts . Unique Identifier Ċ import Ġorg . junit . Test Ċ import Ġkotlin . test . assertEquals Ċ import Ġkotlin . test . assert Fails With Ċ import Ġkotlin . test . assertNot Equals Ċ import Ġkotlin . test . assertTrue Ċ Ċ class ĠDelete Group Flow Test Ġ: ĠMembers hip Management Flow Test ( numberOf Author ised Members Ġ= Ġ 1 , ĠnumberOf Regular Members Ġ= Ġ 1 ) Ġ{ ĊĊĠĠĠ Ġ@ Test ( timeout Ġ= Ġ 3 0 0 _ 0 0 0 ) ĊĠĠĠ Ġfun Ġ` delete Ġgroup Ġflow Ġshould Ġfail Ġif Ġgroup Ġwith Ġgiven ĠID Ġdoesn 't Ġexits `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġauthor ised Member Ġ= Ġauthor ised Members . first () ĊĊĠĠĠĠĠĠĠ Ġval Ġinvalid GroupId Ġ= ĠUnique Identifier () ĊĠĠĠĠĠĠĠ Ġassert Fails With < Business Network Group NotFoundException > Ġ{ Ġrun Delete Group Flow ( author ised Member , Ġinvalid GroupId ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ( timeout Ġ= Ġ 3 0 0 _ 0 0 0 ) ĊĠĠĠ Ġfun Ġ` delete Ġgroup Ġflow Ġshould Ġfail Ġif Ġinvalid Ġnot ary Ġargument Ġis Ġprovided `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġauthor ised Member Ġ= Ġauthor ised Members . first () ĊĊĠĠĠĠĠĠĠ Ġval Ġnetwork Id Ġ= Ġ( run Create Business Network Flow ( author ised Member ). tx . output States . single () Ġas ĠMembers hip State ). network Id ĊĠĠĠĠĠĠĠ Ġval ĠgroupId Ġ= Ġ( run Create Group Flow ( author ised Member , Ġnetwork Id ). tx . output States . single () Ġas ĠGroup State ). linear Id ĊĊĠĠĠĠĠĠĠ Ġassert Fails With < IllegalArgumentException > Ġ{ Ġrun Delete Group Flow ( author ised Member , ĠgroupId , Ġauthor ised Member . identity ()) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ( timeout Ġ= Ġ 3 0 0 _ 0 0 0 ) ĊĠĠĠ Ġfun Ġ` delete Ġgroup Ġflow Ġshould Ġfail Ġif Ġinit iator Ġis Ġnot Ġpart Ġof Ġthe Ġbusiness Ġnetwork , Ġits Ġmembership Ġis Ġnot Ġactive Ġor Ġis Ġnot Ġauthor ised `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġauthor ised Member Ġ= Ġauthor ised Members . first () ĊĠĠĠĠĠĠĠ Ġval Ġregular Member Ġ= Ġregular Members . first () ĊĊĠĠĠĠĠĠĠ Ġval Ġnetwork Id Ġ= Ġ( run Create Business Network Flow ( author ised Member ). tx . output States . single () Ġas ĠMembers hip State ). network Id ĊĊĠĠĠĠĠĠĠ Ġrun Request And Suspend Membership Flow ( regular Member , Ġauthor ised Member , Ġnetwork Id ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġmembership Ġ= Ġtx . output States . single () Ġas ĠMembers hip State ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġgroup Ġ= Ġrun Create Group Flow ( author ised Member , Ġnetwork Id , Ġadditional Participants Ġ= Ġset Of ( membership . linear Id )). tx . output States . single () Ġas ĠGroup State ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval ĠgroupId Ġ= Ġgroup . linear Id ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert Fails With < Illegal Membership Status Exception > Ġ{ Ġrun Delete Group Flow ( regular Member , ĠgroupId ) Ġ} ĊĊĠĠĠĠĠĠĠĠĠĠĠ Ġrun Activate Membership Flow ( author ised Member , Ġmembership . linear Id ) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert Fails With < Membership Author isation Exception > Ġ{ Ġrun Delete Group Flow ( regular Member , ĠgroupId ) Ġ} ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ( timeout Ġ= Ġ 3 0 0 _ 0 0 0 ) ĊĠĠĠ Ġfun Ġ` delete Ġgroup Ġflow Ġshould Ġfail Ġif Ġany Ġmember Ġremains Ġwithout Ġany Ġgroup Ġparticip ation `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġauthor ised Member Ġ= Ġauthor ised Members . first () ĊĊĠĠĠĠĠĠĠ Ġval Ġnetwork Id Ġ= Ġ( run Create Business Network Flow ( author ised Member ). tx . output States . single () Ġas ĠMembers hip State ). network Id ĊĠĠĠĠĠĠĠ Ġval ĠgroupId Ġ= ĠgetAll Groups From Vault ( author ised Member , Ġnetwork Id ). single (). linear Id ĊĠĠĠĠĠĠĠ Ġassert Fails With < Membership Missing Group Part icipation Exception > Ġ{ Ġrun Delete Group Flow ( author ised Member , ĠgroupId ) Ġ} ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ( timeout Ġ= Ġ 3 0 0 _ 0 0 0 ) ĊĠĠĠ Ġfun Ġ` delete Ġgroup Ġflow Ġhappy Ġpath `() Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġauthor ised Member Ġ= Ġauthor ised Members . first () ĊĠĠĠĠĠĠĠ Ġval Ġregular Member Ġ= Ġregular Members . first () ĊĊĠĠĠĠĠĠĠ Ġval Ġauthor ised Membership Ġ= Ġrun Create Business Network Flow ( author ised Member ). tx . output States . single () Ġas ĠMembers hip State ĊĠĠĠĠĠĠĠ Ġval Ġnetwork Id Ġ= Ġauthor ised Membership . network Id ĊĠĠĠĠĠĠĠ Ġval Ġregular Membership Ġ= Ġrun Request And Activate Membership Flows ( regular Member , Ġauthor ised Member , Ġnetwork Id ). tx . output States . single () Ġas ĠMembers hip State ĊĊĠĠĠĠĠĠĠ Ġval Ġgroup Ġ= Ġrun Create Group Flow ( author ised Member , Ġnetwork Id , Ġadditional Participants Ġ= Ġset Of ( regular Membership . linear Id )). tx . output States . single () Ġas ĠGroup State ĊĠĠĠĠĠĠĠ Ġrun Delete Group Flow ( author ised Member , Ġgroup . linear Id ). apply Ġ{ ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertEquals ( 1 , Ġtx . inputs . size ) ĊĠĠĠĠĠĠĠĠĠĠĠ ĠassertTrue ( tx . outputs . isEmpty ()) ĊĠĠĠĠĠĠĠĠĠĠĠ Ġverify Required Signatures () ĊĠĠĠĠĠĠĠ Ġ} ĊĊĠĠĠĠĠĠĠ Ġ// Ġalso Ġcheck Ġled gers ĊĠĠĠĠĠĠĠ ĠlistOf ( author ised Member , Ġregular Member ). forEach Ġ{ Ġmember Ġ-> ĊĠĠĠĠĠĠĠĠĠĠĠ Ġval Ġledger Group Ġ= ĠgetAll Groups From Vault ( member , Ġnetwork Id ). single () ĊĠĠĠĠĠĠĠĠĠĠĠ Ġassert Not Equals ( group , Ġledger Group ) ĊĠĠĠĠĠĠĠ Ġ} ĊĠĠĠ Ġ} Ċ }