SlideShare a Scribd company logo
Unit Testing on 
Android 
Hussain Mansoor
Frameworks Required 
 Mockito (doesn’t handle final, static and anonymous 
class) 
 PowerMock (wrapper on top of Mockito) 
 RoboElectric (executes UT on Dalvik VM) 
 JSONAssert (to verify JSON data) 
 JUnit (to help with assertions)
Concepts 
 What Unit Test covers? 
 What to Test? 
 Mocking a Layer 
 Injecting code into layer 
 Stubbing a method 
 Set up method 
 Tear Down method 
 Ignore Exception Handling
Types of mocking 
 static mock 
 PowerMockito.mockStatic(DefaultHttpClient.class); 
 Singleton class 
 PowerMockito.suppress(PowerMockito.constructor(S 
ession.class)); 
 final method 
 private method
Stub 
 PowerMockito.stub( 
PowerMockito.method( 
ParentPostRequest.class, ”methodNameToStubed") 
).toReturn(false);
Arguments to methods
Ad

More Related Content

Similar to Unit Testing Android Application (20)

Introduction to Testing Frameworks
Introduction to Testing Frameworks Introduction to Testing Frameworks
Introduction to Testing Frameworks
Hemant Shori
 
Easymock Tutorial
Easymock TutorialEasymock Tutorial
Easymock Tutorial
Sbin m
 
Solit 2012, TDD и отдельные аспекты тестирования в Java, Антонина Шафранская
Solit 2012, TDD и отдельные аспекты тестирования в Java, Антонина ШафранскаяSolit 2012, TDD и отдельные аспекты тестирования в Java, Антонина Шафранская
Solit 2012, TDD и отдельные аспекты тестирования в Java, Антонина Шафранская
solit
 
Power mock
Power mockPower mock
Power mock
Piyush Mittal
 
Mastering Mock Objects - Advanced Unit Testing for Java
Mastering Mock Objects - Advanced Unit Testing for JavaMastering Mock Objects - Advanced Unit Testing for Java
Mastering Mock Objects - Advanced Unit Testing for Java
Denilson Nastacio
 
JMockit Framework Overview
JMockit Framework OverviewJMockit Framework Overview
JMockit Framework Overview
Mario Peshev
 
Mocking in Java with Mockito
Mocking in Java with MockitoMocking in Java with Mockito
Mocking in Java with Mockito
Richard Paul
 
Android testing
Android testingAndroid testing
Android testing
Sean Tsai
 
Mockito with a hint of PowerMock
Mockito with a hint of PowerMockMockito with a hint of PowerMock
Mockito with a hint of PowerMock
Ying Zhang
 
An Introduction To Unit Testing and TDD
An Introduction To Unit Testing and TDDAn Introduction To Unit Testing and TDD
An Introduction To Unit Testing and TDD
Ahmed Ehab AbdulAziz
 
Unit testing 101
Unit testing 101Unit testing 101
Unit testing 101
Erkin Ünlü
 
Junit mockito and PowerMock in Java
Junit mockito and  PowerMock in JavaJunit mockito and  PowerMock in Java
Junit mockito and PowerMock in Java
Ankur Maheshwari
 
Unit testing basic
Unit testing basicUnit testing basic
Unit testing basic
Yuri Anischenko
 
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
Unit & Automation Testing in Android - Stanislav Gatsev, MelonUnit & Automation Testing in Android - Stanislav Gatsev, Melon
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
beITconference
 
Unit testing with mock libs
Unit testing with mock libsUnit testing with mock libs
Unit testing with mock libs
Valentin Kolesnikov
 
Mockito intro
Mockito introMockito intro
Mockito intro
Jonathan Holloway
 
31b - JUnit and Mockito.pdf
31b - JUnit and Mockito.pdf31b - JUnit and Mockito.pdf
31b - JUnit and Mockito.pdf
gauravavam
 
groovy & grails - lecture 7
groovy & grails - lecture 7groovy & grails - lecture 7
groovy & grails - lecture 7
Alexandre Masselot
 
testing ppt
testing ppttesting ppt
testing ppt
techweb08
 
Hotspot & hotswap, who and who are best freinds
Hotspot & hotswap, who and who are best freindsHotspot & hotswap, who and who are best freinds
Hotspot & hotswap, who and who are best freinds
亚军 汪
 
Introduction to Testing Frameworks
Introduction to Testing Frameworks Introduction to Testing Frameworks
Introduction to Testing Frameworks
Hemant Shori
 
Easymock Tutorial
Easymock TutorialEasymock Tutorial
Easymock Tutorial
Sbin m
 
Solit 2012, TDD и отдельные аспекты тестирования в Java, Антонина Шафранская
Solit 2012, TDD и отдельные аспекты тестирования в Java, Антонина ШафранскаяSolit 2012, TDD и отдельные аспекты тестирования в Java, Антонина Шафранская
Solit 2012, TDD и отдельные аспекты тестирования в Java, Антонина Шафранская
solit
 
Mastering Mock Objects - Advanced Unit Testing for Java
Mastering Mock Objects - Advanced Unit Testing for JavaMastering Mock Objects - Advanced Unit Testing for Java
Mastering Mock Objects - Advanced Unit Testing for Java
Denilson Nastacio
 
JMockit Framework Overview
JMockit Framework OverviewJMockit Framework Overview
JMockit Framework Overview
Mario Peshev
 
Mocking in Java with Mockito
Mocking in Java with MockitoMocking in Java with Mockito
Mocking in Java with Mockito
Richard Paul
 
Android testing
Android testingAndroid testing
Android testing
Sean Tsai
 
Mockito with a hint of PowerMock
Mockito with a hint of PowerMockMockito with a hint of PowerMock
Mockito with a hint of PowerMock
Ying Zhang
 
An Introduction To Unit Testing and TDD
An Introduction To Unit Testing and TDDAn Introduction To Unit Testing and TDD
An Introduction To Unit Testing and TDD
Ahmed Ehab AbdulAziz
 
Junit mockito and PowerMock in Java
Junit mockito and  PowerMock in JavaJunit mockito and  PowerMock in Java
Junit mockito and PowerMock in Java
Ankur Maheshwari
 
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
Unit & Automation Testing in Android - Stanislav Gatsev, MelonUnit & Automation Testing in Android - Stanislav Gatsev, Melon
Unit & Automation Testing in Android - Stanislav Gatsev, Melon
beITconference
 
31b - JUnit and Mockito.pdf
31b - JUnit and Mockito.pdf31b - JUnit and Mockito.pdf
31b - JUnit and Mockito.pdf
gauravavam
 
Hotspot & hotswap, who and who are best freinds
Hotspot & hotswap, who and who are best freindsHotspot & hotswap, who and who are best freinds
Hotspot & hotswap, who and who are best freinds
亚军 汪
 

More from Hussain Mansoor (17)

Cloud for Enterprise - AWS Community Day Dubai 2022
Cloud for Enterprise - AWS Community Day Dubai 2022Cloud for Enterprise - AWS Community Day Dubai 2022
Cloud for Enterprise - AWS Community Day Dubai 2022
Hussain Mansoor
 
FAST - Karachi Campus - Cloud Computing Introduction
FAST - Karachi Campus - Cloud Computing IntroductionFAST - Karachi Campus - Cloud Computing Introduction
FAST - Karachi Campus - Cloud Computing Introduction
Hussain Mansoor
 
FiresideChat on Serverless Architecture
FiresideChat on Serverless ArchitectureFiresideChat on Serverless Architecture
FiresideChat on Serverless Architecture
Hussain Mansoor
 
Serverless Architecture for Beginners - Murdoch Dubai - AWS UG Dubai.pptx
Serverless Architecture for Beginners - Murdoch Dubai - AWS UG Dubai.pptxServerless Architecture for Beginners - Murdoch Dubai - AWS UG Dubai.pptx
Serverless Architecture for Beginners - Murdoch Dubai - AWS UG Dubai.pptx
Hussain Mansoor
 
Certification Journey in AWS Cloud
Certification Journey in AWS CloudCertification Journey in AWS Cloud
Certification Journey in AWS Cloud
Hussain Mansoor
 
Scale Engineering using Cloud. AWS CommunityDay Pakistan 2021
Scale Engineering using Cloud. AWS CommunityDay Pakistan 2021Scale Engineering using Cloud. AWS CommunityDay Pakistan 2021
Scale Engineering using Cloud. AWS CommunityDay Pakistan 2021
Hussain Mansoor
 
Intro to docker - innovation demo 2022
Intro to docker - innovation demo 2022Intro to docker - innovation demo 2022
Intro to docker - innovation demo 2022
Hussain Mansoor
 
Design patterns of Distributed Systems
Design patterns of Distributed SystemsDesign patterns of Distributed Systems
Design patterns of Distributed Systems
Hussain Mansoor
 
Android developer to tech leadership
Android developer to tech leadershipAndroid developer to tech leadership
Android developer to tech leadership
Hussain Mansoor
 
SRE 101 (Site Reliability Engineering)
SRE 101 (Site Reliability Engineering)SRE 101 (Site Reliability Engineering)
SRE 101 (Site Reliability Engineering)
Hussain Mansoor
 
Observability and DevOps Improvements
Observability and DevOps ImprovementsObservability and DevOps Improvements
Observability and DevOps Improvements
Hussain Mansoor
 
Cache options for Data Layer
Cache options for Data LayerCache options for Data Layer
Cache options for Data Layer
Hussain Mansoor
 
AWS Lambda and Infrastructure as Code
AWS Lambda and Infrastructure as CodeAWS Lambda and Infrastructure as Code
AWS Lambda and Infrastructure as Code
Hussain Mansoor
 
Why everyone should go for Masters Degree
Why everyone should go for Masters DegreeWhy everyone should go for Masters Degree
Why everyone should go for Masters Degree
Hussain Mansoor
 
Agile101
Agile101Agile101
Agile101
Hussain Mansoor
 
DevOps for iOS
DevOps for iOSDevOps for iOS
DevOps for iOS
Hussain Mansoor
 
FAST-NUCES Apps/Games presentation by Husyn 2012
FAST-NUCES Apps/Games presentation by Husyn 2012FAST-NUCES Apps/Games presentation by Husyn 2012
FAST-NUCES Apps/Games presentation by Husyn 2012
Hussain Mansoor
 
Cloud for Enterprise - AWS Community Day Dubai 2022
Cloud for Enterprise - AWS Community Day Dubai 2022Cloud for Enterprise - AWS Community Day Dubai 2022
Cloud for Enterprise - AWS Community Day Dubai 2022
Hussain Mansoor
 
FAST - Karachi Campus - Cloud Computing Introduction
FAST - Karachi Campus - Cloud Computing IntroductionFAST - Karachi Campus - Cloud Computing Introduction
FAST - Karachi Campus - Cloud Computing Introduction
Hussain Mansoor
 
FiresideChat on Serverless Architecture
FiresideChat on Serverless ArchitectureFiresideChat on Serverless Architecture
FiresideChat on Serverless Architecture
Hussain Mansoor
 
Serverless Architecture for Beginners - Murdoch Dubai - AWS UG Dubai.pptx
Serverless Architecture for Beginners - Murdoch Dubai - AWS UG Dubai.pptxServerless Architecture for Beginners - Murdoch Dubai - AWS UG Dubai.pptx
Serverless Architecture for Beginners - Murdoch Dubai - AWS UG Dubai.pptx
Hussain Mansoor
 
Certification Journey in AWS Cloud
Certification Journey in AWS CloudCertification Journey in AWS Cloud
Certification Journey in AWS Cloud
Hussain Mansoor
 
Scale Engineering using Cloud. AWS CommunityDay Pakistan 2021
Scale Engineering using Cloud. AWS CommunityDay Pakistan 2021Scale Engineering using Cloud. AWS CommunityDay Pakistan 2021
Scale Engineering using Cloud. AWS CommunityDay Pakistan 2021
Hussain Mansoor
 
Intro to docker - innovation demo 2022
Intro to docker - innovation demo 2022Intro to docker - innovation demo 2022
Intro to docker - innovation demo 2022
Hussain Mansoor
 
Design patterns of Distributed Systems
Design patterns of Distributed SystemsDesign patterns of Distributed Systems
Design patterns of Distributed Systems
Hussain Mansoor
 
Android developer to tech leadership
Android developer to tech leadershipAndroid developer to tech leadership
Android developer to tech leadership
Hussain Mansoor
 
SRE 101 (Site Reliability Engineering)
SRE 101 (Site Reliability Engineering)SRE 101 (Site Reliability Engineering)
SRE 101 (Site Reliability Engineering)
Hussain Mansoor
 
Observability and DevOps Improvements
Observability and DevOps ImprovementsObservability and DevOps Improvements
Observability and DevOps Improvements
Hussain Mansoor
 
Cache options for Data Layer
Cache options for Data LayerCache options for Data Layer
Cache options for Data Layer
Hussain Mansoor
 
AWS Lambda and Infrastructure as Code
AWS Lambda and Infrastructure as CodeAWS Lambda and Infrastructure as Code
AWS Lambda and Infrastructure as Code
Hussain Mansoor
 
Why everyone should go for Masters Degree
Why everyone should go for Masters DegreeWhy everyone should go for Masters Degree
Why everyone should go for Masters Degree
Hussain Mansoor
 
FAST-NUCES Apps/Games presentation by Husyn 2012
FAST-NUCES Apps/Games presentation by Husyn 2012FAST-NUCES Apps/Games presentation by Husyn 2012
FAST-NUCES Apps/Games presentation by Husyn 2012
Hussain Mansoor
 
Ad

Recently uploaded (20)

Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
Lionel Briand
 
Innovative Approaches to Software Dev no good at all
Innovative Approaches to Software Dev no good at allInnovative Approaches to Software Dev no good at all
Innovative Approaches to Software Dev no good at all
ayeshakanwal75
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Download MathType Crack Version 2025???
Download MathType Crack  Version 2025???Download MathType Crack  Version 2025???
Download MathType Crack Version 2025???
Google
 
Maximizing ROI with Odoo Staff Augmentation A Smarter Way to Scale
Maximizing ROI with Odoo Staff Augmentation  A Smarter Way to ScaleMaximizing ROI with Odoo Staff Augmentation  A Smarter Way to Scale
Maximizing ROI with Odoo Staff Augmentation A Smarter Way to Scale
SatishKumar2651
 
sequencediagrams.pptx software Engineering
sequencediagrams.pptx software Engineeringsequencediagrams.pptx software Engineering
sequencediagrams.pptx software Engineering
aashrithakondapalli8
 
Best Practices for Collaborating with 3D Artists in Mobile Game Development
Best Practices for Collaborating with 3D Artists in Mobile Game DevelopmentBest Practices for Collaborating with 3D Artists in Mobile Game Development
Best Practices for Collaborating with 3D Artists in Mobile Game Development
Juego Studios
 
Time Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project TechniquesTime Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project Techniques
Livetecs LLC
 
Implementing promises with typescripts, step by step
Implementing promises with typescripts, step by stepImplementing promises with typescripts, step by step
Implementing promises with typescripts, step by step
Ran Wahle
 
Meet the New Kid in the Sandbox - Integrating Visualization with Prometheus
Meet the New Kid in the Sandbox - Integrating Visualization with PrometheusMeet the New Kid in the Sandbox - Integrating Visualization with Prometheus
Meet the New Kid in the Sandbox - Integrating Visualization with Prometheus
Eric D. Schabell
 
Solar-wind hybrid engery a system sustainable power
Solar-wind  hybrid engery a system sustainable powerSolar-wind  hybrid engery a system sustainable power
Solar-wind hybrid engery a system sustainable power
bhoomigowda12345
 
The Elixir Developer - All Things Open
The Elixir Developer - All Things OpenThe Elixir Developer - All Things Open
The Elixir Developer - All Things Open
Carlo Gilmar Padilla Santana
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509
Fermin Galan
 
Why Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card ProvidersWhy Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card Providers
Tapitag
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Streamline Your Manufacturing Data. Strengthen Every Operation.
Streamline Your Manufacturing Data. Strengthen Every Operation.Streamline Your Manufacturing Data. Strengthen Every Operation.
Streamline Your Manufacturing Data. Strengthen Every Operation.
Aparavi
 
Cryptocurrency Exchange Script like Binance.pptx
Cryptocurrency Exchange Script like Binance.pptxCryptocurrency Exchange Script like Binance.pptx
Cryptocurrency Exchange Script like Binance.pptx
riyageorge2024
 
Not So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java WebinarNot So Common Memory Leaks in Java Webinar
Not So Common Memory Leaks in Java Webinar
Tier1 app
 
Landscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature ReviewLandscape of Requirements Engineering for/by AI through Literature Review
Landscape of Requirements Engineering for/by AI through Literature Review
Hironori Washizaki
 
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
FlakyFix: Using Large Language Models for Predicting Flaky Test Fix Categorie...
Lionel Briand
 
Innovative Approaches to Software Dev no good at all
Innovative Approaches to Software Dev no good at allInnovative Approaches to Software Dev no good at all
Innovative Approaches to Software Dev no good at all
ayeshakanwal75
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Download MathType Crack Version 2025???
Download MathType Crack  Version 2025???Download MathType Crack  Version 2025???
Download MathType Crack Version 2025???
Google
 
Maximizing ROI with Odoo Staff Augmentation A Smarter Way to Scale
Maximizing ROI with Odoo Staff Augmentation  A Smarter Way to ScaleMaximizing ROI with Odoo Staff Augmentation  A Smarter Way to Scale
Maximizing ROI with Odoo Staff Augmentation A Smarter Way to Scale
SatishKumar2651
 
sequencediagrams.pptx software Engineering
sequencediagrams.pptx software Engineeringsequencediagrams.pptx software Engineering
sequencediagrams.pptx software Engineering
aashrithakondapalli8
 
Best Practices for Collaborating with 3D Artists in Mobile Game Development
Best Practices for Collaborating with 3D Artists in Mobile Game DevelopmentBest Practices for Collaborating with 3D Artists in Mobile Game Development
Best Practices for Collaborating with 3D Artists in Mobile Game Development
Juego Studios
 
Time Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project TechniquesTime Estimation: Expert Tips & Proven Project Techniques
Time Estimation: Expert Tips & Proven Project Techniques
Livetecs LLC
 
Implementing promises with typescripts, step by step
Implementing promises with typescripts, step by stepImplementing promises with typescripts, step by step
Implementing promises with typescripts, step by step
Ran Wahle
 
Meet the New Kid in the Sandbox - Integrating Visualization with Prometheus
Meet the New Kid in the Sandbox - Integrating Visualization with PrometheusMeet the New Kid in the Sandbox - Integrating Visualization with Prometheus
Meet the New Kid in the Sandbox - Integrating Visualization with Prometheus
Eric D. Schabell
 
Solar-wind hybrid engery a system sustainable power
Solar-wind  hybrid engery a system sustainable powerSolar-wind  hybrid engery a system sustainable power
Solar-wind hybrid engery a system sustainable power
bhoomigowda12345
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509Orion Context Broker introduction 20250509
Orion Context Broker introduction 20250509
Fermin Galan
 
Why Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card ProvidersWhy Tapitag Ranks Among the Best Digital Business Card Providers
Why Tapitag Ranks Among the Best Digital Business Card Providers
Tapitag
 
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRYLEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
LEARN SEO AND INCREASE YOUR KNOWLDGE IN SOFTWARE INDUSTRY
NidaFarooq10
 
Streamline Your Manufacturing Data. Strengthen Every Operation.
Streamline Your Manufacturing Data. Strengthen Every Operation.Streamline Your Manufacturing Data. Strengthen Every Operation.
Streamline Your Manufacturing Data. Strengthen Every Operation.
Aparavi
 
Cryptocurrency Exchange Script like Binance.pptx
Cryptocurrency Exchange Script like Binance.pptxCryptocurrency Exchange Script like Binance.pptx
Cryptocurrency Exchange Script like Binance.pptx
riyageorge2024
 
Ad

Unit Testing Android Application

  • 1. Unit Testing on Android Hussain Mansoor
  • 2. Frameworks Required  Mockito (doesn’t handle final, static and anonymous class)  PowerMock (wrapper on top of Mockito)  RoboElectric (executes UT on Dalvik VM)  JSONAssert (to verify JSON data)  JUnit (to help with assertions)
  • 3. Concepts  What Unit Test covers?  What to Test?  Mocking a Layer  Injecting code into layer  Stubbing a method  Set up method  Tear Down method  Ignore Exception Handling
  • 4. Types of mocking  static mock  PowerMockito.mockStatic(DefaultHttpClient.class);  Singleton class  PowerMockito.suppress(PowerMockito.constructor(S ession.class));  final method  private method
  • 5. Stub  PowerMockito.stub( PowerMockito.method( ParentPostRequest.class, ”methodNameToStubed") ).toReturn(false);