Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method VerifyHasSanityCheckFor ( 
 | 
  MacroPlan macroplan, 
 | 
  String expectedSanityCheckGroupName, 
 | 
  String expectedInstance, 
 | 
  String expectedSanityCheckDescription 
 | 
) 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    SanityCheckGroup::DoSanityCheck( macroplan ); // Refresh sanity check message 
 | 
     
 | 
    sanityCheckGroup := select( macroplan, SanityCheckGroup, g, g.Group() = expectedSanityCheckGroupName ); 
 | 
     
 | 
    // Ensure sanity check group exists before checking for the specific sanity check message 
 | 
    if( isnull( sanityCheckGroup ) ) 
 | 
    { 
 | 
      this.Run().RegisterFailure( 'Verify sanity check fail. Sanity check group "' + expectedSanityCheckGroupName + '" not found.' + String::NewLine() + 
 | 
                                  'Object = ' + expectedInstance + String::NewLine() +  
 | 
                                  'Description = ' + expectedSanityCheckDescription ); 
 | 
    }  
 | 
    else 
 | 
    { 
 | 
      // Check if sanity check message contains the PARTIAL expected text (not exact match as sanity check message prefix with more details such as object type involved) 
 | 
      // Also checks the message contains the object type (e.g PISP name, unit name, etc) 
 | 
      sanityCheckExists := exists( sanityCheckGroup, SanityCheckMessage, m, not m.IsValid() // SanityCheckMessage that is resolved by user still exist, thus we check this boolean 
 | 
                                                                            and m.Description() ~ expectedInstance  
 | 
                                                                            and m.Description() ~ expectedSanityCheckDescription ); 
 | 
       
 | 
      this.Run().AssertTrue( sanityCheckExists, 'Verify sanity check fail. Cannot find sanity check message "' + expectedSanityCheckDescription + '".' + String::NewLine() + 
 | 
                                                'Group = ' + expectedSanityCheckGroupName + String::NewLine() +  
 | 
                                                'Object = ' + expectedInstance ); 
 | 
    } 
 | 
  *] 
 | 
  InterfaceProperties { Accessibility: 'Module' } 
 | 
} 
 |