Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Mockito Essentials

You're reading from   Mockito Essentials A practical guide to get you up and running with unit testing using Mockito

Arrow left icon
Product type Paperback
Published in Oct 2014
Publisher
ISBN-13 9781783983605
Length 214 pages
Edition 1st Edition
Tools
Arrow right icon
Author (1):
Arrow left icon
 Acharya Acharya
Author Profile Icon Acharya
Acharya
Arrow right icon
View More author details
Toc

Index

A

  • acceptance tests
    • URL / Exploring BDD
  • advanced Mockito
    • about / Learning advanced Mockito features
  • advanced Mockito APIs
    • void methods / Working with void methods
    • exception, throwing from void methods / Throwing exceptions from void methods
    • void method callbacks / Working with void method callbacks
    • doCallRealMethod method / Learning doCallRealMethod and doNothing
    • doNothing method / Learning doCallRealMethod and doNothing
    • doReturn() method / Exploring doReturn
    • arguments, verifying ArgumentCaptor used / Verifying arguments using ArgumentCaptor
    • invocation order, verifying / Verifying an invocation order
    • objects, spying / Spying objects
    • annotations / Exploring Mockito annotations
    • default Mockito settings, modifying / Changing the default Mockito settings
    • mock objects, resetting / Resetting mock objects
    • inline stubbing / Working with inline stubbing
    • mock details, determining / Determining mock details
  • agile methodologies
    • about / Exploring BDD
    • URL / Exploring BDD
  • agile team
    • scoping feature / Exploring BDD
  • Ajax
    • exploring / Exploring Ajax and GWT
    • URL / Exploring Ajax and GWT
  • Apache Axis
    • JAX-WS, creating with / Exploring JAX-WS with Eclipse
  • Apache Tomcat
    • URL, for installation / Exploring JAX-WS with Eclipse
    • JAX-WS, creating with / Exploring JAX-WS with Eclipse
  • ArgumentCaptor object
    • used, for verifying arguments / Verifying arguments using ArgumentCaptor
  • argument matchers
    • using / Using argument matchers
  • arguments
    • verifying, ArgumentCaptor object used / Verifying arguments using ArgumentCaptor
  • arrays
    • working with / Working with variable arguments and arrays

B

  • bar object / Working with inline stubbing
  • BDD
    • about / Understanding the context of BDD
    • top-down strategy, exploring / Exploring the top-down strategy
    • bottom-up strategy, exploring / Exploring the bottom-up strategy
    • gaps, finding / Finding the gaps
    • exploring / Exploring BDD
    • exercising, with Mockito / Exercising BDD with Mockito
    • URL / The BDD syntax
  • BDD syntax
    • about / The BDD syntax
    • willReturn() method / The BDD syntax
    • willThrow() method / The BDD syntax
    • will() method / The BDD syntax
    • willAnswer() method / The BDD syntax
    • willCallRealMethod() method / The BDD syntax
  • benefits, mocking / Realizing the significance of Mockito
  • bottom-up approach
    • used, for developing JAX-WS / Exploring JAX-WS with Eclipse
  • bottom-up strategy, BDD
    • exploring / Exploring the bottom-up strategy
  • builder pattern
    • about / Exploring a test spy

C

  • @captor annotation
    • example / Exploring Mockito annotations
  • Cascading Style Sheets (CSS)
    • about / Exploring Ajax and GWT
  • CGLib
    • URL / Understanding the Mockito architecture
  • comparison matchers
    • about / Comparison matchers – equalTo, is, and not
    • equalTo / Comparison matchers – equalTo, is, and not
    • is / Comparison matchers – equalTo, is, and not
    • not / Comparison matchers – equalTo, is, and not
  • compound value matchers
    • about / Compound value matchers – either, both, anyOf, allOf, and not
    • either / Compound value matchers – either, both, anyOf, allOf, and not
    • both / Compound value matchers – either, both, anyOf, allOf, and not
    • anyOf / Compound value matchers – either, both, anyOf, allOf, and not
    • allOf / Compound value matchers – either, both, anyOf, allOf, and not
    • not / Compound value matchers – either, both, anyOf, allOf, and not
  • constructor injection / Exploring Mockito annotations
  • custom ArgumentMatcher class
    • working with / Working with a custom ArgumentMatcher class
    • comparison matchers / Comparison matchers – equalTo, is, and not
    • compound value matchers / Compound value matchers – either, both, anyOf, allOf, and not

D

  • database call
    • mocking, reasons / Working with void method callbacks
  • DDD
    • URL / Exploring BDD
  • default Mockito settings
    • modifying / Changing the default Mockito settings
    • RETURNS_DEFAULTS / Changing the default Mockito settings
    • RETURNS_SMART_NULLS / Changing the default Mockito settings
    • RETURNS_MOCKS / Changing the default Mockito settings
    • RETURNS_DEEP_STUBS / Changing the default Mockito settings
    • CALLS_REAL_METHODS / Changing the default Mockito settings
  • defined constructor
    • suppressing, in PowerMock / Suppressing our own constructor
  • DemoController servlet / Working with void methods
  • DispatcherServlet class
    • about / Building a RESTful web service with Spring Framework
  • doCallRealMethod method
    • about / Learning doCallRealMethod and doNothing
  • doNothing() method
    • about / Learning doCallRealMethod and doNothing
  • doReturn() method
    • exploring / Exploring doReturn
  • dummy objects
    • using / Using dummy objects
  • Dynamic HTML (DHTML)
    • about / Exploring Ajax and GWT

E

  • EasyMock
    • about / The BDD syntax
  • Eclipse
    • URL, for downloading / Using dummy objects
    • JAX-WS, exploring with / Exploring JAX-WS with Eclipse
    • URL, for installation / Exploring JAX-WS with Eclipse
  • enrollToCourse method / Exploring a test spy
  • event handler
    • about / Developing a GWT application using MVP
  • exception
    • throwing, from void methods / Throwing exceptions from void methods
  • exceptions
    • throwing / Throwing exceptions

F

  • fake object
    • about / Working with private methods
  • fake objects
    • implementing / Implementing fake objects – simulators
  • faking
    • about / Working with private methods
  • field injection / Exploring Mockito annotations
  • final classes
    • stubbing, in PowerMock / Mocking final classes
    • working with, for unit test / Working with final classes
  • final methods
    • stubbing, in PowerMock / Stubbing final methods
    • working with, for unit test / Working with final methods

G

  • Gang of Four (GoF)
    • about / Exploring static method issues
  • gaps, BDD
    • finding / Finding the gaps
  • generic collection arguments
    • working with / Working with generic collection arguments
  • Google Plugin for Eclipse
    • URL, for downloading / Developing a GWT application using MVP
  • GWT
    • exploring / Exploring Ajax and GWT
    • advantages / Exploring Ajax and GWT
  • GWT application
    • developing, MVP pattern used / Developing a GWT application using MVP
  • GWT code
    • unit testing, performing with Mockito / Unit testing the GWT code

H

  • Hamcrest
    • about / Working with a custom ArgumentMatcher class
  • hamcrest matchers / Using argument matchers
  • HtmlUnit browser
    • about / Unit testing the GWT code
  • HttpServlet / Working with void methods
  • HTTP status codes
    • about / Developing a RESTful web service
  • Hypermedia as the Engine of Application State (HATEOAS)
    • about / Developing a RESTful web service
  • HyperText Transfer Protocol (HTTP)
    • about / Working with web services

I

  • @InjectMocks annotation
    • example / Exploring Mockito annotations
  • inline stubbing
    • working with / Working with inline stubbing
  • invocation order
    • verifying / Verifying an invocation order

J

  • JavaScript Object Notation (JSON)
    • about / Working with web services
  • JAX-RS
    • about / Working with web services
    • reference link / Working with web services
  • JAX-WS
    • about / Working with web services
    • reference link / Working with web services
    • exploring, with Eclipse / Exploring JAX-WS with Eclipse
    • developing, using top-down approach / Exploring JAX-WS with Eclipse
    • developing, using bottom-up approach / Exploring JAX-WS with Eclipse
    • creating, with Apache Axis / Exploring JAX-WS with Eclipse
    • creating, with Apache Tomcat / Exploring JAX-WS with Eclipse
  • JBehave
    • URL / The BDD syntax
  • jMock
    • about / The BDD syntax

L

  • legacy
    • about / Understanding the legacy code
  • legacy code
    • about / Understanding the legacy code
    • reference link / Understanding the legacy code
  • LoginController class / Working with void methods

M

  • @Mock annotation / Stubbing method calls
  • matchers
    • reference link / Using argument matchers
  • Maven repository
    • URL / Adding a Mockito dependency
  • media types, RESTful web services
    • about / Developing a RESTful web service
  • method calls
    • stubbing / Stubbing method calls
    • retrieve method / Stubbing method calls
    • when() method / Stubbing method calls
    • thenThrow() method / Stubbing method calls
    • thenAnswer() method / Stubbing method calls
    • thenCallRealMethod() method / Stubbing method calls
    • thenReturn() method / Stubbing method calls
    • thenReturn(value) method / Stubbing method calls
    • verifying / Verifying method calls
    • zero interactions, verifying / Verifying zero and no-more interactions
    • no more interactions, verifying / Verifying zero and no-more interactions
    • answering / Answering method calls
  • method calls, verifying
    • about / Verifying method calls
    • times(int wantedNumberOfInvocations) / Verifying method calls
    • never() / Verifying method calls
    • atLeastOnce() / Verifying method calls
    • atLeast(int minNumberOfInvocations) / Verifying method calls
    • atMost(int maxNumberOfInvocations) / Verifying method calls
    • only() / Verifying method calls
    • timeout(int millis) / Verifying method calls
  • MethodInvocation class / Exploring a test spy
  • methods
    • suppressing, in PowerMock / Suppressing methods
  • mock details
    • determining / Determining mock details
  • mocking
    • benefits / Realizing the significance of Mockito
  • Mockito
    • about / Exploring Mockito
    • references / Exploring Mockito, Working with Mockito
    • significance, realizing / Realizing the significance of Mockito
    • working with / Working with Mockito
    • URL, for variable argument capture / Working with variable arguments and arrays
    • BDD, exercising with / Exercising BDD with Mockito
    • unit test, designing / Designing for testability with Mockito
    • used, for unit testing GWT code / Unit testing the GWT code
  • Mockito annotations
    • @Captor / Exploring Mockito annotations
    • @Spy / Exploring Mockito annotations
    • @InjectMocks / Exploring Mockito annotations
  • Mockito architecture
    • about / Understanding the Mockito architecture
  • Mockito dependency
    • adding / Adding a Mockito dependency
  • mock objects
    • about / Getting started with mock objects
    • resetting / Resetting mock objects
  • model, MVP pattern
    • about / Learning the MVP pattern
  • MVP pattern
    • about / Learning the MVP pattern
    • model / Learning the MVP pattern
    • view / Learning the MVP pattern
    • presenter / Learning the MVP pattern
    • used, for developing GWT application / Developing a GWT application using MVP

N

  • new operator
    • usage concerns / Learning new concerns

O

  • objects
    • spying / Spying objects
  • operations/HTTP headers
    • POST operation / Developing a RESTful web service
    • GET operation / Developing a RESTful web service
    • PUT operation / Developing a RESTful web service
    • DELETE operation / Developing a RESTful web service

P

  • Plain Old Java Object (POJO) / Working with stubs
  • PowerMock
    • about / Working with PowerMock
    • working with / Working with PowerMock
    • URL / Working with PowerMock
    • static methods, stubbing / Stubbing static methods
    • static blocks, suppressing / Suppressing static blocks
    • super class constructor, suppressing / Suppressing a superclass constructor
    • defined constructor, suppressing / Suppressing our own constructor
    • methods, suppressing / Suppressing methods
    • private methods, stubbing / Stubbing private methods
    • final methods, stubbing / Stubbing final methods
    • final classes, mocking / Mocking final classes
  • PowerMock's distribution
    • URL, for downloading / Working with PowerMock
  • presenter, MVP pattern
    • about / Learning the MVP pattern
  • private methods
    • stubbing, in PowerMock / Stubbing private methods
    • working with, for unit test / Working with private methods

R

  • Remote Procedure Calls (RPCs)
    • about / Learning the MVP pattern
  • render() method
    • about / Developing a GWT application using MVP
  • request.getServletPath() method / Exploring doReturn
  • resource URLs
    • about / Developing a RESTful web service
  • RESTful web services
    • about / Working with web services
    • developing / Developing a RESTful web service
    • URL, for details / Developing a RESTful web service
    • building, with Spring Framework / Building a RESTful web service with Spring Framework
  • RESTful web services, components
    • resource URLs / Developing a RESTful web service
    • operations/HTTP headers / Developing a RESTful web service
    • media types / Developing a RESTful web service
    • HTTP status codes / Developing a RESTful web service

S

  • @spy annotation
    • example / Exploring Mockito annotations
  • servlet-api.<version number>.jar
    • URL, for downloading / Working with void methods
  • setter injection / Exploring Mockito annotations
  • Simple Object Access Protocol (SOAP)
    • about / Working with web services
  • SOA
    • about / Exploring Service-oriented Architecture (SOA)
    • URL / Exploring Service-oriented Architecture (SOA)
  • software delivery risks
    • best practices, for minimizing / Finding the gaps
  • software development
    • stakeholders / Understanding the context of BDD
  • Spring Framework
    • RESTful web services, building with / Building a RESTful web service with Spring Framework
  • Spring MVC
    • about / Building a RESTful web service with Spring Framework
  • stakeholders, software development
    • customers / Understanding the context of BDD
    • analysts / Understanding the context of BDD
    • designers/architects / Understanding the context of BDD
    • developers / Understanding the context of BDD
    • testers / Understanding the context of BDD
    • operational folks / Understanding the context of BDD
    • maintenance team / Understanding the context of BDD
    • managers / Understanding the context of BDD
  • static blocks
    • suppressing, in PowerMock / Suppressing static blocks
    • exploring, for unit test / Exploring static variables and blocks
  • static methods
    • stubbing, in PowerMock / Stubbing static methods
    • mock circumstances / Stubbing static methods
  • static variables
    • exploring, for unit test / Exploring static variables and blocks
  • stubs
    • working with / Working with stubs
  • StudentService class / Exploring a test spy
  • super class constructor
    • suppressing, in PowerMock / Suppressing a superclass constructor

T

  • TDD
    • URL / Exploring BDD
  • test automation
    • benefits / Working with unit tests
  • test doubles
    • about / Understanding test doubles
    • dummy objects / Using dummy objects
    • stubs / Working with stubs
    • spy / Exploring a test spy
    • mock objects / Getting started with mock objects
    • fake objects / Implementing fake objects – simulators
  • test failure scenario
    • demonstrating / Getting started with mock objects
  • testing-unfriendly behaviors
    • examples / Realizing the significance of Mockito
  • testing impediments
    • exploring / Exploring testing impediments
  • test spy
    • exploring / Exploring a test spy
  • top-down approach
    • used, for developing JAX-WS / Exploring JAX-WS with Eclipse
  • top-down strategy, BDD
    • exploring / Exploring the top-down strategy

U

  • Uniform Resource Identifiers (URIs)
    • about / Developing a RESTful web service
  • unit test
    • designing, with Mockito / Designing for testability with Mockito
    • constructor issues, identifying / Identifying constructor issues
    • initialization issues, realizing / Realizing initialization issues
    • private methods, working with / Working with private methods
    • final methods, working with / Working with final methods
    • static method issues, exploring / Exploring static method issues
    • final classes, working with / Working with final classes
    • new operator, usage concerns / Learning new concerns
    • static variables, exploring / Exploring static variables and blocks
    • static blocks, exploring / Exploring static variables and blocks
  • unit testing
    • performing, on GWT code with Mockito / Unit testing the GWT code
  • unit tests
    • working with / Working with unit tests
    • characteristics / Working with unit tests
    • principles / Exploring unit test qualities

V

  • variable arguments
    • working with / Working with variable arguments and arrays
  • verify() method / Verifying method calls
  • verifyNoMoreInteractions (Object, mocks) method / Verifying zero and no-more interactions
  • verifyZeroInteractions (object, mocks) method / Verifying zero and no-more interactions
  • view, MVP pattern
    • about / Learning the MVP pattern
  • void method callbacks
    • working with / Working with void method callbacks
  • void methods
    • working with / Working with void methods
    • doGet() / Working with void methods
    • doPost() / Working with void methods
    • process() / Working with void methods
    • verify() / Working with void methods
    • exception, throwing from / Throwing exceptions from void methods

W

  • web services
    • about / Working with web services
    • characteristics / Working with web services
  • wildcard matchers
    • working with / Working with wildcard matchers
  • WSDL
    • about / Working with web services
  • WSDL document, elements
    • types / Exploring JAX-WS with Eclipse
    • message / Exploring JAX-WS with Eclipse
    • operation / Exploring JAX-WS with Eclipse
    • port type / Exploring JAX-WS with Eclipse
    • port / Exploring JAX-WS with Eclipse
    • binding / Exploring JAX-WS with Eclipse
    • service / Exploring JAX-WS with Eclipse

Y

  • YAGNI (You Aren't Going to Need It) principle / Finding the gaps
lock icon The rest of the chapter is locked
arrow left Previous Section
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images