All Downloads are FREE. Search and download functionalities are using the official Maven repository.

core_analytics_quality.tests.propertyChecksTest.pure Maven / Gradle / Ivy

There is a newer version: 4.67.8
Show newest version
import apps::pure::quality::*;
import meta::analytics::quality::*;
import meta::analytics::quality::model::domain::tests::*;
import meta::analytics::quality::model::*;

Class meta::analytics::quality::model::domain::tests::MyOtherTestClass
{
   name: String[1];

   nameReversed() {
      $this.name->chunk(1)->reverse()->joinStrings()
   }:String[1];

   nameReversed_Untested() {
      $this.nameReversed()
   }:String[1];

}

function <>   meta::analytics::quality::model::domain::tests::myOtherTestClassNameReversed():Boolean[1]
{
   assertEquals('cba', ^MyOtherTestClass(name='abc').nameReversed());
}


// function <>   meta::analytics::quality::tests::qualifiedPropertiesShouldBeTestedTest():Boolean[1]
// {
//    let v = runClassPropertyQualityCheck(MyOtherTestClass, qualifiedPropertiesShouldBeTested_AbstractProperty_1__CheckResult_MANY_, true);
//    let failedMessages = $v.detail->filter(v|!$v.isValid).message;

//    assertEquals(['Property nameReversed_Untested not found in any test'], $failedMessages);
// }


function <> meta::analytics::quality::model::domain::tests::runClassPropertyQualityCheck(c : Class[1], ruleFunction: FunctionDefinition<{AbstractProperty[1]->Any[*]}>[1], forceNotSkipTestsFlag : Boolean[1]) : ViolationInstance[*]
{
   let propRules = meta::analytics::quality::model::domain::createRule($ruleFunction)->cast(@Rule>)->map(r|if($forceNotSkipTestsFlag, | ^$r(hasSkipTestsFlag=false), | $r));

   let v = meta::analytics::quality::model::domain::runClassPropertyQualityChecks(MyOtherTestClass, $propRules);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy