SlideShare a Scribd company logo
1 of 14
MUNIT MATCHERS
Shanky Gupta
OVERVIEW
MUnit matchers are a set of MEL functions that help in the creation of mocks
and validations (verifications/assertions). They enable you to define mocks,
verifications and assertions in terms of general values rather than specific
hardcoded values.
A matcher is a boolean function. In most of the MUnit matchers, this function
is a class type comparison. Its purpose is to validate if an argument belongs
to a certain class type.
A matcher does not receive parameters; rather, it’s a parameter itself.
isNull()
• Matches if the evaluated object is Null.
isNotNull()
• Matches if the evaluated object is not Null.
anyObject()
• Matches if the evaluated object is an Object.
anyBoolean()
• Matches if the evaluated object is a Boolean.
anyByte()
anyByteArray()
• Matches if the evaluated object is a Byte.
• Matches if the evaluated object is a ByteArray.
anyInt()
anyDouble()
• Matches if the evaluated object is a Double.
• Matches if the evaluated object is an Integer.
anyFloat()
anyShort()
• Matches if the evaluated object is a Short.
• Matches if the evaluated object is a Float.
anyString()
anyCollection()
• Matches if the evaluated object is a Collection.
• Matches if the evaluated object is a String.
anyList()
anySet()
anyMap()
• Matches if the evaluated object is a List.
• Matches if the evaluated object is a Set.
• Matches if the evaluated object is a Map.
…MATCHER FUNCTIONS CONTINUED
MUnit also offers some additional, rather specific, type of matchers. These
matchers evaluate thecontent of the parameter, not its type; even so, they do
not evaluate by specific values.
matchRegex(<regex>)
matchContains(<string_to_look_for>)
• Matches if the value of the attribute during the test run verifies the user-provided
regular expression
• Matches if the value of the attribute during the test run contains the specified user-
provided string.
USAGE INSTRUCTION
• MUnit matchers are always used in combination with the Mocks, Spy, Verify and
Assert message processors, but never on their own.
MUNIT MATCHERS OVER MULE
MESSAGE PROPERTIES
• If you wish to run assertions over Mule message properties and use MUnit matchers,
you can use the valueOf() function.
• To make it easier to write this type of assertions, MUnit offers a another set of MEL
functions that provide direct access for Mule message’s properties ElementMatcher.
messageInboundProperty(propertyName)
• Returns an ElementMatcher for the inbound property with the name
provided.
messageOutboundProperty(propertyName)
messageInvocationProperty(propertyName)
• Returns an ElementMatcher for the outbound property with the name
provided.
• Returns an ElementMatcher for the invocation property with the name
provided.
messageInboundAttachment(propertyName)
messageOutboundAttachment(propertyName)
• Returns an ElementMatcher for the inbound attachment with the name
provided.
• Returns an ElementMatcher for the outbound attachment with the name
provided.

More Related Content

What's hot

IRJET- Implementation and Unittests of AWS, Google Storage (Cloud) and Am...
IRJET-  	  Implementation and Unittests of AWS, Google Storage (Cloud) and Am...IRJET-  	  Implementation and Unittests of AWS, Google Storage (Cloud) and Am...
IRJET- Implementation and Unittests of AWS, Google Storage (Cloud) and Am...IRJET Journal
 
Item Analysis: Classical and Beyond
Item Analysis: Classical and BeyondItem Analysis: Classical and Beyond
Item Analysis: Classical and BeyondMhairi Mcalpine
 
Introduction to Item Response Theory
Introduction to Item Response TheoryIntroduction to Item Response Theory
Introduction to Item Response TheoryOpenThink Labs
 
Ap Power Point Chpt8
Ap Power Point Chpt8Ap Power Point Chpt8
Ap Power Point Chpt8dplunkett
 
CounterFactual Explanations.pdf
CounterFactual Explanations.pdfCounterFactual Explanations.pdf
CounterFactual Explanations.pdfBong-Ho Lee
 
PATTERNS02 - Creational Design Patterns
PATTERNS02 - Creational Design PatternsPATTERNS02 - Creational Design Patterns
PATTERNS02 - Creational Design PatternsMichael Heron
 
The application of irt using the rasch model presnetation1
The application of irt using the rasch model presnetation1The application of irt using the rasch model presnetation1
The application of irt using the rasch model presnetation1Carlo Magno
 
Wrapper feature selection method
Wrapper feature selection methodWrapper feature selection method
Wrapper feature selection methodAmir Razmjou
 
Lesson11 more behavioural patterns
Lesson11 more behavioural patternsLesson11 more behavioural patterns
Lesson11 more behavioural patternsOktJona
 

What's hot (12)

IRJET- Implementation and Unittests of AWS, Google Storage (Cloud) and Am...
IRJET-  	  Implementation and Unittests of AWS, Google Storage (Cloud) and Am...IRJET-  	  Implementation and Unittests of AWS, Google Storage (Cloud) and Am...
IRJET- Implementation and Unittests of AWS, Google Storage (Cloud) and Am...
 
Item Analysis: Classical and Beyond
Item Analysis: Classical and BeyondItem Analysis: Classical and Beyond
Item Analysis: Classical and Beyond
 
Introduction to Item Response Theory
Introduction to Item Response TheoryIntroduction to Item Response Theory
Introduction to Item Response Theory
 
Ap Power Point Chpt8
Ap Power Point Chpt8Ap Power Point Chpt8
Ap Power Point Chpt8
 
CounterFactual Explanations.pdf
CounterFactual Explanations.pdfCounterFactual Explanations.pdf
CounterFactual Explanations.pdf
 
PATTERNS02 - Creational Design Patterns
PATTERNS02 - Creational Design PatternsPATTERNS02 - Creational Design Patterns
PATTERNS02 - Creational Design Patterns
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
The application of irt using the rasch model presnetation1
The application of irt using the rasch model presnetation1The application of irt using the rasch model presnetation1
The application of irt using the rasch model presnetation1
 
Wrapper feature selection method
Wrapper feature selection methodWrapper feature selection method
Wrapper feature selection method
 
Classical Test Theory (CTT)- By Dr. Jai Singh
Classical Test Theory (CTT)- By Dr. Jai SinghClassical Test Theory (CTT)- By Dr. Jai Singh
Classical Test Theory (CTT)- By Dr. Jai Singh
 
Mediator pattern
Mediator patternMediator pattern
Mediator pattern
 
Lesson11 more behavioural patterns
Lesson11 more behavioural patternsLesson11 more behavioural patterns
Lesson11 more behavioural patterns
 

Viewers also liked

MuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to DatabaseMuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to Databaseakashdprajapati
 
Mule tcat server - deploying applications
Mule tcat server - deploying applicationsMule tcat server - deploying applications
Mule tcat server - deploying applicationsShanky Gupta
 
Mule with velocity
Mule with velocityMule with velocity
Mule with velocityKhan625
 
What have you learnt from audience feedback?
What have you learnt from audience feedback?What have you learnt from audience feedback?
What have you learnt from audience feedback?WillRussell6
 
0531 981 01 90 FATİH KİTAP ALANLAR-PLAK-KİTAP-ANTİKA EŞYA SATIN ALANLAR 0531 ...
0531 981 01 90 FATİH KİTAP ALANLAR-PLAK-KİTAP-ANTİKA EŞYA SATIN ALANLAR 0531 ...0531 981 01 90 FATİH KİTAP ALANLAR-PLAK-KİTAP-ANTİKA EŞYA SATIN ALANLAR 0531 ...
0531 981 01 90 FATİH KİTAP ALANLAR-PLAK-KİTAP-ANTİKA EŞYA SATIN ALANLAR 0531 ...Antika Alanlar
 
Makenna morgan hobbies
Makenna morgan hobbiesMakenna morgan hobbies
Makenna morgan hobbies20morgam
 
The Secret Balance of The Workshop - by Ahead Event Management
The Secret Balance of The Workshop - by Ahead Event ManagementThe Secret Balance of The Workshop - by Ahead Event Management
The Secret Balance of The Workshop - by Ahead Event ManagementAhead Event Management
 
Configuring Anypoint Studio MQ connector
Configuring Anypoint Studio MQ connectorConfiguring Anypoint Studio MQ connector
Configuring Anypoint Studio MQ connectorShanky Gupta
 
Mule message structure
Mule message structureMule message structure
Mule message structureShanky Gupta
 
Mule tcat server - Server profiles
Mule tcat server - Server profilesMule tcat server - Server profiles
Mule tcat server - Server profilesShanky Gupta
 
Mule agent notifications
Mule agent notificationsMule agent notifications
Mule agent notificationsShanky Gupta
 
MUnit run and wait scope
MUnit run and wait scopeMUnit run and wait scope
MUnit run and wait scopeShanky Gupta
 
MuleSoft CloudHub FAQ
MuleSoft CloudHub FAQMuleSoft CloudHub FAQ
MuleSoft CloudHub FAQShanky Gupta
 
Magazine name ideas
Magazine name ideasMagazine name ideas
Magazine name ideasemilyallenxx
 

Viewers also liked (20)

MuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to DatabaseMuleSoft ESB - CSV File to Database
MuleSoft ESB - CSV File to Database
 
Mule tcat server - deploying applications
Mule tcat server - deploying applicationsMule tcat server - deploying applications
Mule tcat server - deploying applications
 
Mule with velocity
Mule with velocityMule with velocity
Mule with velocity
 
Cloudhub fabric
Cloudhub fabricCloudhub fabric
Cloudhub fabric
 
Perpetual Help U-Week 2010 Programme Of Activities
Perpetual Help U-Week 2010 Programme Of ActivitiesPerpetual Help U-Week 2010 Programme Of Activities
Perpetual Help U-Week 2010 Programme Of Activities
 
What have you learnt from audience feedback?
What have you learnt from audience feedback?What have you learnt from audience feedback?
What have you learnt from audience feedback?
 
0531 981 01 90 FATİH KİTAP ALANLAR-PLAK-KİTAP-ANTİKA EŞYA SATIN ALANLAR 0531 ...
0531 981 01 90 FATİH KİTAP ALANLAR-PLAK-KİTAP-ANTİKA EŞYA SATIN ALANLAR 0531 ...0531 981 01 90 FATİH KİTAP ALANLAR-PLAK-KİTAP-ANTİKA EŞYA SATIN ALANLAR 0531 ...
0531 981 01 90 FATİH KİTAP ALANLAR-PLAK-KİTAP-ANTİKA EŞYA SATIN ALANLAR 0531 ...
 
#EgresadosInterlat presentación 2016
#EgresadosInterlat presentación 2016#EgresadosInterlat presentación 2016
#EgresadosInterlat presentación 2016
 
Makenna morgan hobbies
Makenna morgan hobbiesMakenna morgan hobbies
Makenna morgan hobbies
 
Burak Bora High School
Burak Bora High SchoolBurak Bora High School
Burak Bora High School
 
The Secret Balance of The Workshop - by Ahead Event Management
The Secret Balance of The Workshop - by Ahead Event ManagementThe Secret Balance of The Workshop - by Ahead Event Management
The Secret Balance of The Workshop - by Ahead Event Management
 
Configuring Anypoint Studio MQ connector
Configuring Anypoint Studio MQ connectorConfiguring Anypoint Studio MQ connector
Configuring Anypoint Studio MQ connector
 
Shotlist
ShotlistShotlist
Shotlist
 
Mule message structure
Mule message structureMule message structure
Mule message structure
 
Mule tcat server - Server profiles
Mule tcat server - Server profilesMule tcat server - Server profiles
Mule tcat server - Server profiles
 
Mule agent notifications
Mule agent notificationsMule agent notifications
Mule agent notifications
 
MUnit run and wait scope
MUnit run and wait scopeMUnit run and wait scope
MUnit run and wait scope
 
MuleSoft CloudHub FAQ
MuleSoft CloudHub FAQMuleSoft CloudHub FAQ
MuleSoft CloudHub FAQ
 
Magazine name ideas
Magazine name ideasMagazine name ideas
Magazine name ideas
 
Mule testing
Mule testingMule testing
Mule testing
 

More from Shanky Gupta

Mule tcat server - common problems and solutions
Mule tcat server - common problems and solutionsMule tcat server - common problems and solutions
Mule tcat server - common problems and solutionsShanky Gupta
 
Anypoint access management - Roles
Anypoint access management - RolesAnypoint access management - Roles
Anypoint access management - RolesShanky Gupta
 
Mule access management - Managing Environments and Permissions
Mule access management - Managing Environments and PermissionsMule access management - Managing Environments and Permissions
Mule access management - Managing Environments and PermissionsShanky Gupta
 
Mule: Munit domain support
Mule: Munit domain supportMule: Munit domain support
Mule: Munit domain supportShanky Gupta
 
Mule tcat server - Monitoring a server
Mule tcat server - Monitoring a serverMule tcat server - Monitoring a server
Mule tcat server - Monitoring a serverShanky Gupta
 
Mule tcat server - Monitoring applications
Mule tcat server - Monitoring applicationsMule tcat server - Monitoring applications
Mule tcat server - Monitoring applicationsShanky Gupta
 
Mule tcat server - automating tasks
Mule tcat server - automating tasks Mule tcat server - automating tasks
Mule tcat server - automating tasks Shanky Gupta
 
Mule management console Architecture
Mule management console ArchitectureMule management console Architecture
Mule management console ArchitectureShanky Gupta
 
CloudHub networking guide
CloudHub networking guideCloudHub networking guide
CloudHub networking guideShanky Gupta
 
Using mule with web services
Using mule with web servicesUsing mule with web services
Using mule with web servicesShanky Gupta
 
Mule management console
Mule management consoleMule management console
Mule management consoleShanky Gupta
 
Anypoint access management - Users
Anypoint access management - UsersAnypoint access management - Users
Anypoint access management - UsersShanky Gupta
 
Anypoint access management
Anypoint access management Anypoint access management
Anypoint access management Shanky Gupta
 
MUnit - Testing Mule
MUnit - Testing MuleMUnit - Testing Mule
MUnit - Testing MuleShanky Gupta
 
Cloud hub scalability and availability
Cloud hub scalability and availabilityCloud hub scalability and availability
Cloud hub scalability and availabilityShanky Gupta
 
Cloud hub architecture
Cloud hub architectureCloud hub architecture
Cloud hub architectureShanky Gupta
 
OAuth 2.0 authorization
OAuth 2.0 authorization OAuth 2.0 authorization
OAuth 2.0 authorization Shanky Gupta
 

More from Shanky Gupta (20)

Mule tcat server - common problems and solutions
Mule tcat server - common problems and solutionsMule tcat server - common problems and solutions
Mule tcat server - common problems and solutions
 
Anypoint access management - Roles
Anypoint access management - RolesAnypoint access management - Roles
Anypoint access management - Roles
 
Mule access management - Managing Environments and Permissions
Mule access management - Managing Environments and PermissionsMule access management - Managing Environments and Permissions
Mule access management - Managing Environments and Permissions
 
Mule: Munit domain support
Mule: Munit domain supportMule: Munit domain support
Mule: Munit domain support
 
Mule tcat server - Monitoring a server
Mule tcat server - Monitoring a serverMule tcat server - Monitoring a server
Mule tcat server - Monitoring a server
 
Mule tcat server - Monitoring applications
Mule tcat server - Monitoring applicationsMule tcat server - Monitoring applications
Mule tcat server - Monitoring applications
 
Mule tcat server - automating tasks
Mule tcat server - automating tasks Mule tcat server - automating tasks
Mule tcat server - automating tasks
 
Mule management console Architecture
Mule management console ArchitectureMule management console Architecture
Mule management console Architecture
 
CloudHub networking guide
CloudHub networking guideCloudHub networking guide
CloudHub networking guide
 
Using mule with web services
Using mule with web servicesUsing mule with web services
Using mule with web services
 
Mule management console
Mule management consoleMule management console
Mule management console
 
Cloudhub and Mule
Cloudhub and MuleCloudhub and Mule
Cloudhub and Mule
 
Mule Security
Mule SecurityMule Security
Mule Security
 
Anypoint access management - Users
Anypoint access management - UsersAnypoint access management - Users
Anypoint access management - Users
 
Anypoint access management
Anypoint access management Anypoint access management
Anypoint access management
 
The Mule Agent
The Mule AgentThe Mule Agent
The Mule Agent
 
MUnit - Testing Mule
MUnit - Testing MuleMUnit - Testing Mule
MUnit - Testing Mule
 
Cloud hub scalability and availability
Cloud hub scalability and availabilityCloud hub scalability and availability
Cloud hub scalability and availability
 
Cloud hub architecture
Cloud hub architectureCloud hub architecture
Cloud hub architecture
 
OAuth 2.0 authorization
OAuth 2.0 authorization OAuth 2.0 authorization
OAuth 2.0 authorization
 

Recently uploaded

Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfjimielynbastida
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Recently uploaded (20)

Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Science&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdfScience&tech:THE INFORMATION AGE STS.pdf
Science&tech:THE INFORMATION AGE STS.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

MUnit matchers

  • 2. OVERVIEW MUnit matchers are a set of MEL functions that help in the creation of mocks and validations (verifications/assertions). They enable you to define mocks, verifications and assertions in terms of general values rather than specific hardcoded values. A matcher is a boolean function. In most of the MUnit matchers, this function is a class type comparison. Its purpose is to validate if an argument belongs to a certain class type. A matcher does not receive parameters; rather, it’s a parameter itself.
  • 3. isNull() • Matches if the evaluated object is Null. isNotNull() • Matches if the evaluated object is not Null.
  • 4. anyObject() • Matches if the evaluated object is an Object. anyBoolean() • Matches if the evaluated object is a Boolean.
  • 5. anyByte() anyByteArray() • Matches if the evaluated object is a Byte. • Matches if the evaluated object is a ByteArray.
  • 6. anyInt() anyDouble() • Matches if the evaluated object is a Double. • Matches if the evaluated object is an Integer.
  • 7. anyFloat() anyShort() • Matches if the evaluated object is a Short. • Matches if the evaluated object is a Float.
  • 8. anyString() anyCollection() • Matches if the evaluated object is a Collection. • Matches if the evaluated object is a String.
  • 9. anyList() anySet() anyMap() • Matches if the evaluated object is a List. • Matches if the evaluated object is a Set. • Matches if the evaluated object is a Map.
  • 10. …MATCHER FUNCTIONS CONTINUED MUnit also offers some additional, rather specific, type of matchers. These matchers evaluate thecontent of the parameter, not its type; even so, they do not evaluate by specific values. matchRegex(<regex>) matchContains(<string_to_look_for>) • Matches if the value of the attribute during the test run verifies the user-provided regular expression • Matches if the value of the attribute during the test run contains the specified user- provided string.
  • 11. USAGE INSTRUCTION • MUnit matchers are always used in combination with the Mocks, Spy, Verify and Assert message processors, but never on their own.
  • 12. MUNIT MATCHERS OVER MULE MESSAGE PROPERTIES • If you wish to run assertions over Mule message properties and use MUnit matchers, you can use the valueOf() function. • To make it easier to write this type of assertions, MUnit offers a another set of MEL functions that provide direct access for Mule message’s properties ElementMatcher. messageInboundProperty(propertyName) • Returns an ElementMatcher for the inbound property with the name provided.
  • 13. messageOutboundProperty(propertyName) messageInvocationProperty(propertyName) • Returns an ElementMatcher for the outbound property with the name provided. • Returns an ElementMatcher for the invocation property with the name provided.
  • 14. messageInboundAttachment(propertyName) messageOutboundAttachment(propertyName) • Returns an ElementMatcher for the inbound attachment with the name provided. • Returns an ElementMatcher for the outbound attachment with the name provided.