SlideShare a Scribd company logo
1 of 6
Mock Objects
                                                                                             Replace with
                                                                                              a graphic
    Kishan M V                                                                               White Master
                                                                                          5.5” Tall & 4.3” Wide
    Radhakrishna Bhat
    08/28/2009




Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential.   1
Mock Objects


    In object oriented programming mock objects are simulated objects that
     mimic the behavior of real objects in controlled ways. A computer
     programmer typically creates a mock object to test the behavior of some
     other object Also good for bringing slides over from white template
    In a unit test, mock objects can simulate the behavior of complex, real
     (non-mock) objects and are therefore useful when a real object is
     improper.
    Mock objects have the same interface as the real objects they mimic,
     allowing a client object to remain unaware of whether it is using a real
     object or a mock object. Many available mock object frameworks allow
     the programmer to specify which, and in what order, methods will be
     invoked on a mock object and what parameters will be passed to
     themactical or impossible to incorporate into a unit test



                                                                                          ®




Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential.   2
Technical details

                          Mock objects have the same interface as the real objects they
                           mimic.


                          This allows a client object to remain unaware of whether it is
                           using a real object or a mock object.


                          Many available mock object frameworks allow the programmer
                           to specify which, and in what order, methods, parameters as
                           well as what values will be returned.


                          Thus, the behavior of a complex object such as a network
                           socket can be mimicked by a mock object.


                                                                                            ®




Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential.   3
Frameworks


         A Mock Object Framework is a set of programmable APIs that allow
         creating Mock and Stub Objects in an easier fashion. Mock
         Frameworks save the developer from the need to write repetitive code
         to test or simulate object interactions.



         Some of Java Mock Object frameworks

                          Jmock
                          Easymock
                          Mockmaker


                                                                                          ®




Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential.   4
Limitations

    Refactorings code can break the tests easily
    Results in increased maintenance to keep tests current
    Sometimes too much decoupling rather than straightforward unit tests
     with JUnit




                                                                                          ®




Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential.   5
Better by Adobe




Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential.   6

More Related Content

Similar to Monk objects

Image Magic for PowerBuilder
Image Magic for PowerBuilderImage Magic for PowerBuilder
Image Magic for PowerBuilderMarco Cimaroli
 
Proxy Design Patterns
Proxy Design PatternsProxy Design Patterns
Proxy Design PatternsZafer Genc
 
Session 02 - Elements of Java Language
Session 02 - Elements of Java LanguageSession 02 - Elements of Java Language
Session 02 - Elements of Java LanguagePawanMM
 
MVVM for Modern Applications
MVVM for Modern ApplicationsMVVM for Modern Applications
MVVM for Modern ApplicationsJeremy Likness
 
Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiJared Faris
 
Modular Java EE in the Cloud
Modular Java EE in the CloudModular Java EE in the Cloud
Modular Java EE in the CloudBert Ertman
 
Java Programming
Java ProgrammingJava Programming
Java ProgrammingTracy Clark
 
WebSphere User Group UK: Larger Applications with Worklight
WebSphere User Group UK: Larger Applications with WorklightWebSphere User Group UK: Larger Applications with Worklight
WebSphere User Group UK: Larger Applications with WorklightAndrew Ferrier
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring FrameworkASG
 
Build Comet applications using Scala, Lift, and <b>jQuery</b>
Build Comet applications using Scala, Lift, and <b>jQuery</b>Build Comet applications using Scala, Lift, and <b>jQuery</b>
Build Comet applications using Scala, Lift, and <b>jQuery</b>tutorialsruby
 
<img src="../i/r_14.png" />
<img src="../i/r_14.png" /><img src="../i/r_14.png" />
<img src="../i/r_14.png" />tutorialsruby
 
Next Level Unit Testing - Javacro 2019 - Dominik Poljak
Next Level Unit Testing - Javacro 2019 - Dominik PoljakNext Level Unit Testing - Javacro 2019 - Dominik Poljak
Next Level Unit Testing - Javacro 2019 - Dominik PoljakDominik Poljak
 
Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Javawiradikusuma
 

Similar to Monk objects (20)

Automation strategies for agile testing Gaurav bansal
Automation strategies for agile testing  Gaurav bansalAutomation strategies for agile testing  Gaurav bansal
Automation strategies for agile testing Gaurav bansal
 
Gof design patterns
Gof design patternsGof design patterns
Gof design patterns
 
EasyMock for Java
EasyMock for JavaEasyMock for Java
EasyMock for Java
 
Image Magic for PowerBuilder
Image Magic for PowerBuilderImage Magic for PowerBuilder
Image Magic for PowerBuilder
 
Proxy Design Patterns
Proxy Design PatternsProxy Design Patterns
Proxy Design Patterns
 
Session 02 - Elements of Java Language
Session 02 - Elements of Java LanguageSession 02 - Elements of Java Language
Session 02 - Elements of Java Language
 
MVVM for Modern Applications
MVVM for Modern ApplicationsMVVM for Modern Applications
MVVM for Modern Applications
 
Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript Spaghetti
 
Portlet factory 101
Portlet factory 101Portlet factory 101
Portlet factory 101
 
Modular Java EE in the Cloud
Modular Java EE in the CloudModular Java EE in the Cloud
Modular Java EE in the Cloud
 
Dan Haywood
Dan HaywoodDan Haywood
Dan Haywood
 
P20CSP105-AdvJavaProg.pptx
P20CSP105-AdvJavaProg.pptxP20CSP105-AdvJavaProg.pptx
P20CSP105-AdvJavaProg.pptx
 
Java Programming
Java ProgrammingJava Programming
Java Programming
 
WebSphere User Group UK: Larger Applications with Worklight
WebSphere User Group UK: Larger Applications with WorklightWebSphere User Group UK: Larger Applications with Worklight
WebSphere User Group UK: Larger Applications with Worklight
 
Oops
OopsOops
Oops
 
Introduction to Spring Framework
Introduction to Spring FrameworkIntroduction to Spring Framework
Introduction to Spring Framework
 
Build Comet applications using Scala, Lift, and <b>jQuery</b>
Build Comet applications using Scala, Lift, and <b>jQuery</b>Build Comet applications using Scala, Lift, and <b>jQuery</b>
Build Comet applications using Scala, Lift, and <b>jQuery</b>
 
<img src="../i/r_14.png" />
<img src="../i/r_14.png" /><img src="../i/r_14.png" />
<img src="../i/r_14.png" />
 
Next Level Unit Testing - Javacro 2019 - Dominik Poljak
Next Level Unit Testing - Javacro 2019 - Dominik PoljakNext Level Unit Testing - Javacro 2019 - Dominik Poljak
Next Level Unit Testing - Javacro 2019 - Dominik Poljak
 
Practical OOP In Java
Practical OOP In JavaPractical OOP In Java
Practical OOP In Java
 

Recently uploaded

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
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
 
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
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
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
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"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
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
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
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
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
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
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
 
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)
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
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)
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
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...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"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...
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 

Monk objects

  • 1. Mock Objects Replace with a graphic Kishan M V White Master 5.5” Tall & 4.3” Wide Radhakrishna Bhat 08/28/2009 Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 1
  • 2. Mock Objects  In object oriented programming mock objects are simulated objects that mimic the behavior of real objects in controlled ways. A computer programmer typically creates a mock object to test the behavior of some other object Also good for bringing slides over from white template  In a unit test, mock objects can simulate the behavior of complex, real (non-mock) objects and are therefore useful when a real object is improper.  Mock objects have the same interface as the real objects they mimic, allowing a client object to remain unaware of whether it is using a real object or a mock object. Many available mock object frameworks allow the programmer to specify which, and in what order, methods will be invoked on a mock object and what parameters will be passed to themactical or impossible to incorporate into a unit test ® Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 2
  • 3. Technical details  Mock objects have the same interface as the real objects they mimic.  This allows a client object to remain unaware of whether it is using a real object or a mock object.  Many available mock object frameworks allow the programmer to specify which, and in what order, methods, parameters as well as what values will be returned.  Thus, the behavior of a complex object such as a network socket can be mimicked by a mock object. ® Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 3
  • 4. Frameworks A Mock Object Framework is a set of programmable APIs that allow creating Mock and Stub Objects in an easier fashion. Mock Frameworks save the developer from the need to write repetitive code to test or simulate object interactions. Some of Java Mock Object frameworks  Jmock  Easymock  Mockmaker ® Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 4
  • 5. Limitations  Refactorings code can break the tests easily  Results in increased maintenance to keep tests current  Sometimes too much decoupling rather than straightforward unit tests with JUnit ® Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 5
  • 6. Better by Adobe Copyright 2009 Adobe Systems Incorporated. All rights reserved. Adobe confidential. 6