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
MASTERING UNIT TESTING USING MOCKITO AND JUNIT

You're reading from   MASTERING UNIT TESTING USING MOCKITO AND JUNIT An advanced guide to mastering unit testing using Mockito and JUnit

Arrow left icon
Product type Paperback
Published in Jul 2014
Publisher
ISBN-13 9781783982509
Length 314 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

  • @AfterClass annotation / Exploring annotations
  • Acceptance tests (AT) / Behavior-driven development with Mockito
  • allOf matcher / Working with compound value matchers – either, both, anyOf, allOf, and not
  • Ant
    • quality, monitoring with SonarQube / Monitoring quality with Ant and SonarQube
  • ANT
    • about / Another neat tool (Ant)
    • download, URL / Another neat tool (Ant)
    • using, for Maven project execution / Another neat tool (Ant)
  • Apache Derby
    • URL / Unit testing the persistence logic
    • running / Unit testing the persistence logic
    • phone book application, building / Unit testing the persistence logic
  • appendDescriptionOf() method / Building a custom matcher
  • Archetype plugin
    • about / The Archetype plugin
    • Java project skeleton, generating / The Archetype plugin
  • ArgumentCaptor
    • used, for argument capturing / Capturing arguments with ArgumentCaptor
  • argument matcher
    • using / Using argument matcher
    • wildcard matchers, need for / Why do we need wildcard matchers?
    • ArgumentMatcher class / The ArgumentMatcher class
  • ArgumentMatcher class / The ArgumentMatcher class
  • Aspect Oriented Programming (AOP) / Dealing with JUnit rules
  • assertEquals method
    • importing / Verifying test conditions with Assertion
    • about / Maintaining the assertEquals parameter order
  • Assertion
    • about / Verifying test conditions with Assertion
  • assertions
    • about / Working with assertions
    • best practices / Working with assertions, Maintaining the assertEquals parameter order, Striving for one assertion per test
  • assert methods
    • assertTrue(condition) method / Verifying test conditions with Assertion
    • assertTrue(failure message, condition) method / Verifying test conditions with Assertion
    • assertFalse(condition method) / Verifying test conditions with Assertion
    • assertFalse(failure message, condition) method / Verifying test conditions with Assertion
    • assertNull method / Verifying test conditions with Assertion
    • assertNotNull method / Verifying test conditions with Assertion
    • assertEquals(string message, object expected, object actual) method / Verifying test conditions with Assertion
    • assertEquals assertEquals(object expected, object actual) method / Verifying test conditions with Assertion
    • assertEquals(primitive expected, primitive actual) method / Verifying test conditions with Assertion
    • assertSame(object expected, object actual) method / Verifying test conditions with Assertion
    • assertNotSame method / Verifying test conditions with Assertion
    • using, in test / Verifying test conditions with Assertion
  • assertNotSame method
    • importing / Verifying test conditions with Assertion
  • assertThat method
    • and matcher examples / Asserting with assertThat
  • atLeast(int minNumberOfInvocations) method / Verifying in depth
  • atLeastOnce() method / Verifying in depth
  • atMost(int maxNumberOfInvocations) method / Verifying in depth
  • automated tests / Working with testing impediments
  • automated tools, static code analysis
    • checkstyle / Understanding the static code analysis
    • FindBugs / Understanding the static code analysis
    • PMD / Understanding the static code analysis

B

  • @BeforeClass annotation / Exploring annotations
  • bad practice, error
    • examples / Exploring the FindBugs plugin
  • bad practice examples, error
    • Hash code and equals problems / Exploring the FindBugs plugin
    • Cloneable idiom / Exploring the FindBugs plugin
    • serializable problems / Exploring the FindBugs plugin
    • Misuse of finalize / Exploring the FindBugs plugin
  • BDD / Behavior-driven development with Mockito
  • BDD style
    • tests, writing / Writing tests in BDD style
    • JUnit test, implementing in / Writing tests in BDD style
  • BDD syntax
    • tests, writing in / The BDD syntax
  • benefits, CI / Benefits of CI
  • best practices, assertions
    • correct assertion, using / Using the correct assertion
    • assertEquals parameter order, maintaining / Maintaining the assertEquals parameter order
    • one assertion per test, striving for / Striving for one assertion per test
  • best practices, exception handling / Handling exceptions
  • best practices, test writing
    • readability, improving / Improving readability
    • input combinations, trying / Breaking everything that could possibly break
    • trivial test cases, ignoring / Ignoring simple test cases
    • invalid parameters, verifying / Verifying invalid parameters
    • direct testing / Relying on direct testing
    • application debugging / Staying away from debugging
    • generic matchers, avoiding / Avoiding generic matchers
    • @ignore annotation, avoiding / Keeping away from @ignore
    • debug messages, eluding / Eluding debug messages
  • blue chip share / The ArgumentMatcher class
  • book() method / Working with testing impediments
  • BookingErrorController class / Working with testing impediments
  • builder pattern / Asserting with assertThat
  • building blocks
    • what / Separating concerns
    • who / Separating concerns
    • data store / Separating concerns
    • process / Separating concerns
  • build life cycle, Maven
    • default / The build life cycle
    • clean / The build life cycle
    • site / The build life cycle
    • project, compiling / Compiling the project
    • project, testing / Testing the project
  • built-in matchers
    • exploring / Exploring built-in matchers

C

  • CALLS_REAL_METHODS setting / Changing the default settings
  • checked exceptions / Handling exceptions
  • Checkstyle plugin
    • rules, verifying / Working with the Checkstyle plugin
    • downloading, URL / Working with the Checkstyle plugin
    • configuring / Working with the Checkstyle plugin
  • Checkstyle tool
    • URL / Understanding the static code analysis
  • CI
    • about / Continuous Integration
    • benefits / Benefits of CI
    • tools / Benefits of CI
    • Gradle / Gradle automation
    • Maven project management / Maven project management
    • Ant / Another neat tool (Ant)
  • class test / Defining unit testing
  • clean life cycle, Maven / The clean life cycle
  • Clover plugin
    • installing / Uncovering the Clover plugin
    • executing / Uncovering the Clover plugin
  • Clover tool / Configuring the Eclipse plugin
  • Cobertura Ant task
    • configuring / Running the Cobertura Ant task
  • Cobertura tool / Configuring the Eclipse plugin
  • code
    • analyzing, SonarQube runner used / Analyzing code with the SonarQube runner
    • unit testing, impediments / Working with testing impediments
  • code coverage
    • about / Understanding code coverage
    • metrics / Understanding code coverage
    • measuring / Learning the inner details of code instrumentation
    • code instrumentation / Learning the inner details of code instrumentation
    • measuring, with eCobertura plugin / Examining the eCobertura plugin
  • code coverage, metrics
    • statement or Line coverage / Understanding code coverage
    • branch coverage / Understanding code coverage
    • function or method coverage / Understanding code coverage
  • code instrumentation
    • source code instrumentation / Learning the inner details of code instrumentation
    • object code instrumentation / Learning the inner details of code instrumentation
  • code smells / Working with test smells
  • collection matchers
    • hasItem matcher / Working with collection matchers – hasItem and hasItems
    • hasItems matcher / Working with collection matchers – hasItem and hasItems
  • Common Public License (CPL) / Configuring the Eclipse plugin
  • compile dependencies / The Java plugin
  • compound value matchers
    • either(Matcher) method / Working with compound value matchers – either, both, anyOf, allOf, and not
    • anyOf matcher / Working with compound value matchers – either, both, anyOf, allOf, and not
    • allOf matcher / Working with compound value matchers – either, both, anyOf, allOf, and not
  • confederation
    • about / Writing meaningful tests
  • configuration
    • Eclipse plugin / Configuring the Eclipse plugin
    • Cobertura Ant task / Running the Cobertura Ant task
    • Checkstyle plugin / Working with the Checkstyle plugin
  • consecutive calls
    • method, stubbing for / Stubbing consecutive calls
  • containsString matcher / Exploring string matchers – startsWith, endsWith, and containsString
  • correctness bug, error
    • example / Exploring the FindBugs plugin
  • CRUD methods
    • tasks, invoking from / Simplifying persistence with Spring
  • custom matcher
    • building / Building a custom matcher

D

  • @DataPoint annotation / Exploring JUnit theories
  • @DataPoints annotation / Exploring JUnit theories
  • data access layer
    • testing, with database / Verifying the system integrity
  • data store, building blocks / Separating concerns
  • default setting
    • RETURNS_DEFAULTS / Changing the default settings
    • RETURNS_SMART_NULLS / Changing the default settings
    • RETURNS_MOCKS / Changing the default settings
    • RETURNS_DEEP_STUBS / Changing the default settings
    • CALLS_REAL_METHODS / Changing the default settings
  • doCallRealMethod() API / Stubbing void methods
  • Dodgy errors examples
    • dead store of class literal / Exploring the FindBugs plugin
    • switch fall through / Exploring the FindBugs plugin
    • unconfirmed type casts / Exploring the FindBugs plugin
    • redundant null check / Exploring the FindBugs plugin
  • Domain-driven development (DDD) / Behavior-driven development with Mockito
  • domain-specific language (DSL) / Gradle automation
  • doReturn() method / Stubbing void methods
  • dummy / Dummy

E

  • EasyMock framework
    • URL / The BDD syntax
  • EclEmma plugin
    • about / Working with the EclEmma plugin
    • used, for test configuration / Working with the EclEmma plugin
  • Eclipse
    • using / Working with JUnit 4
    • about / Working with JUnit 4
    • setting up / Setting up Eclipse
    • update site URL / Working with the PMD plugin
  • eclipse command / The Java plugin
  • Eclipse plugin
    • about / The Eclipse plugin
    • used, for Gradle build creating / The Eclipse plugin
    • configuring / Configuring the Eclipse plugin
    • Clover plugin, uncovering / Uncovering the Clover plugin
    • EclEmma plugin, working with / Working with the EclEmma plugin
    • eCobertura plugin, examining / Examining the eCobertura plugin
  • Eclipse Public License (EPL) / Configuring the Eclipse plugin
  • eCobertura plugin
    • URL / Examining the eCobertura plugin
    • about / Examining the eCobertura plugin
    • used, for measuring code coverage / Examining the eCobertura plugin
  • endsWith matcher / Exploring string matchers – startsWith, endsWith, and containsString
  • enterprise application
    • building blocks, what / Separating concerns
    • building blocks, who / Separating concerns
    • building blocks, data store / Separating concerns
    • building blocks, process / Separating concerns
    • view component / Separating concerns
    • controller logic component / Separating concerns
    • persistence logic layer / Separating concerns
  • error categories, FindBugs plugin
    • correctness bug / Exploring the FindBugs plugin
    • bad practice / Exploring the FindBugs plugin
    • dodgy errors / Exploring the FindBugs plugin
  • ErrorCollector rule
    • exploring / Exploring the ErrorCollector rule
  • Europa / Working with JUnit 4
  • exception handling
    • working with / Working with exception handling
    • best practices / Handling exceptions
  • ExpectedException rule
    • working with / Working with the ExpectedException rule

F

  • fake objects / Fake
  • false positives
    • about / Getting familiar with false positives
    • Sonar URL / Getting familiar with false positives
  • final class
    • working with / Working with final classes
  • FindBug
    • URL / Understanding the static code analysis
  • FindBugs Eclipse plugin
    • update site URL / Exploring the FindBugs plugin
  • FindBugs plugin
    • error categories / Exploring the FindBugs plugin
  • first unit test
    • running / Running the first unit test
    • writing / Exploring annotations
    • test condition verification, Assertion used / Verifying test conditions with Assertion
  • flat directory repository / The Java plugin
  • front controller / Building and unit testing a J2EE web application

G

  • Galileo / Working with JUnit 4
  • Gang of Four (GoF) / Exploring static method issues
  • Ganymede / Working with JUnit 4
  • generic matchers
    • avoiding / Avoiding generic matchers
  • getConnection() method / Unit testing the persistence logic
  • getEnvironmentType() method / The Java plugin
  • getInstance() method / Exploring static method issues
  • Google CodePro AnalytiX / Configuring the Eclipse plugin
  • Gradle
    • about / Gradle automation
    • automating / Getting started
    • URL / Getting started
    • Maven repository / The Java plugin
    • ivy repository / The Java plugin
    • flat directory repository / The Java plugin
    • quality, monitoring with SonarQube / Monitoring quality with Gradle and SonarQube
  • Gradle plugin
    • configuring / Measuring coverage using Gradle
  • Gradle plugins
    • about / Gradle plugins
    • Eclipse plugin / The Eclipse plugin
    • Java plugin / The Java plugin
  • greenfield code
    • working with / Working with greenfield code
  • Groovy
    • about / Gradle automation

H

  • hasItem / Working with collection matchers – hasItem and hasItems
  • hasItems / Working with collection matchers – hasItem and hasItems
  • Helios / Working with JUnit 4
  • Hotspot view / Analyzing code with the SonarQube runner

I

  • @ignore annotations / Keeping away from @ignore
  • Indigo / Working with JUnit 4
  • indirect testing
    • examples / Relying on direct testing
  • inline stubbing
    • working with / Working with inline stubbing
  • installation
    • Maven / Installation
  • integration tests
    • writing, with Spring / Writing integration tests with Spring
  • invocation order
    • verifying / Verifying the invocation order
  • ivy repository / The Java plugin

J

  • J2EE web application
    • building / Building and unit testing a J2EE web application
    • unit testing / Building and unit testing a J2EE web application
  • jaCoCo plugin / Measuring coverage using Gradle
  • JaCoCo tool / Configuring the Eclipse plugin
  • Java code coverage tools
    • Cobertura / Configuring the Eclipse plugin
    • EMMA / Configuring the Eclipse plugin
    • Clover / Configuring the Eclipse plugin
    • JaCoCo / Configuring the Eclipse plugin
  • Java Development Kit (JDK) / Installation
  • Java Development Tools (JDT) / The Eclipse plugin
  • Java plugin
    • about / The Java plugin
    • used, for Gradle build script creating / The Java plugin
  • Java Virtual Machine (JVM) / Gradle automation
  • JBehave
    • URL / The BDD syntax
  • JBehave framework / Behavior-driven development with Mockito
  • JDBC code
    • testing / Verifying the system integrity
  • JDBC JAR
    • URL / Simplifying persistence with Spring
  • Jenkins / Learning assumptions
    • about / Jenkins
    • installation, URL / Jenkins
    • Gradle plugin, installing in / The Gradle project
    • configuring, for Maven build job execution / The Maven project
    • Ant project, building / Building the Ant project
    • wiki, URL / Building the Ant project
  • jMock framework
    • URL / The BDD syntax
  • JUnit
    • about / Working with JUnit 4
  • JUnit (4.11)
    • URL / Working with JUnit 4
  • JUnit4
    • @Test annotation / Exploring annotations
    • @Before annotation / Exploring annotations
  • JUnit 4
    • advantages / Working with JUnit 4
    • Eclipse, setting up / Setting up Eclipse
    • @Before annotation / Exploring annotations
    • @AfterClass annotation / Exploring annotations
    • exception handling, working with / Working with exception handling
    • @RunWith annotation / Exploring the @RunWith annotation
  • JUnit 4++
    • test, ignoring / Ignoring a test
    • test, executing in order / Executing tests in order
    • assumption, using / Learning assumptions
    • test suite, exploring / Exploring the test suite
  • JUnit categories
    • exploring / Exploring JUnit categories
  • JUnit rules
    • about / Dealing with JUnit rules
    • timeout rule / Playing with the timeout rule
    • ExpectedException rule / Working with the ExpectedException rule
    • TemporaryFolder rule / Unfolding the TemporaryFolder rule
    • ErrorCollector rule / Exploring the ErrorCollector rule
    • Verifier rule / Working with the Verifier rule
    • TestWatcher rule / Learning the TestWatcher rule
    • TestName rule / Working with the TestName rule
    • external resources, handling / Handling external resources
  • JUnit test automation
    • benefits / Automating JUnit tests
  • JUnit theory
    • about / Exploring JUnit theories
    • @Theory annotation / Exploring JUnit theories
    • @DataPoint annotation / Exploring JUnit theories
    • @DataPoints annotation / Exploring JUnit theories
    • @ParametersSuppliedBy annotation / Exploring JUnit theories
    • Theories annotation / Exploring JUnit theories
    • ParameterSupplier annotation / Exploring JUnit theories
    • exploring / Exploring JUnit theories
    • data externalization, @ParametersSuppliedBy used / Externalizing data using @ParametersSuppliedBy and ParameterSupplier
  • Juno / Working with JUnit 4

K

  • KEPLER (4.3) / Working with JUnit 4

L

  • legacy code
    • working with / Working with the legacy code
  • loadDriver() method / Unit testing the persistence logic
  • Luna / Working with JUnit 4

M

  • @Mock annotation
    • using / Mocking objects
  • matchers
    • equalTo method / Comparing matchers – equalTo, is, and not
    • not attribute / Comparing matchers – equalTo, is, and not
  • Matchers.argThat(Matcher) method / Using argument matcher
  • Maven
    • about / Maven project management
    • installation setup / Installation
    • dependency scopes, compile / Project dependency
    • dependency scopes, runtime / Project dependency
    • dependency scopes, test / Project dependency
    • dependency scopes, provided / Project dependency
    • build life cycle / The build life cycle
    • clean life cycle / The clean life cycle
    • site life cycle / The site life cycle
    • Cobertura plugin / Working with the Maven Cobertura plugin
    • configuring, for Cobertura report generation / Working with the Maven Cobertura plugin
    • quality, monitoring with SonarQube / Monitoring quality with Maven and SonarQube
  • maven() method / The Java plugin
  • Maven central repository / The Java plugin
  • Maven Cobertura plugin
    • working with / Working with the Maven Cobertura plugin
  • Maven local repository / The Java plugin
  • Maven repository
    • about / The Java plugin
    • Maven central repository / The Java plugin
    • Maven local repository / The Java plugin
  • method invocation
    • verifying / Verifying the method invocation, Verifying in depth
    • verification need / Why do we use verify?
    • verifying, methods / Verifying in depth
    • verifyZeroInteractions(Object... mocks) method / Verifying zero and no more interactions
    • verifyNoMoreInteractions(Object... mocks) method / Verifying zero and no more interactions
  • MethodSorters.DEFAULT constant / Executing tests in order
  • MethodSorters.JVM constant / Executing tests in order
  • MethodSorters.NAME_ASCENDING constant / Executing tests in order
  • mock
    • creating / Mocking objects
  • mocking details
    • determining / Determining mocking details
  • Mockito
    • working with / Working with Mockito
    • URL / Working with Mockito
    • features / Why should you use Mockito?
    • test execution delay, reasons / Why should you use Mockito?
    • unit testing / Qualities of unit testing
    • configuring / Configuring Mockito
    • in action / Mocking in action
    • objects, mocking / Mocking objects
    • stubbing methods / Stubbing methods
    • exceptional conditions, testing / Throwing exceptions
    • consecutive calls, stubbing / Stubbing consecutive calls
    • stubbing, with Answer interface / Stubbing with an Answer
    • stubbing, with Answer / Stubbing with an Answer
    • object, spying / Spying objects
    • default setting, changing / Changing the default settings
    • BDD / Behavior-driven development with Mockito
  • Mockito annotations
    • rexploring / Exploring Mockito annotations
    • @Captor / Exploring Mockito annotations
    • @Spy / Exploring Mockito annotations
    • @InjectMocks / Exploring Mockito annotations
  • mock objects / Mock
    • resetting / Resetting mock objects
  • MVC
    • model / Unit testing servlets
    • view / Unit testing servlets
    • servlets, unit testing / Unit testing servlets
    • controller / Unit testing servlets

N

  • never() method / Verifying in depth
  • new operator / Learning the new attribute

O

  • object-oriented programming (OOP) / Behavior-driven development with Mockito
  • only() method / Verifying in depth

P

  • @ParametersSuppliedBy annotation / Exploring JUnit theories
    • using / Externalizing data using @ParametersSuppliedBy and ParameterSupplier
  • parameterized constructors
    • used, for building tests / Working with parameterized constructors
  • parameterized tests
    • creating / Creating parameterized tests
    • constructor / Working with parameterized constructors
    • building, with constructor / Working with parameterized constructors
    • running, @Parameter annotation used / Working with parameterized methods
    • methods / Working with parameterized methods
    • naming / Giving a name
    • timeouts, working with / Working with timeouts
    • drawbacks / Exploring JUnit theories
  • ParameterSupplier annotation / Exploring JUnit theories
    • using / Externalizing data using @ParametersSuppliedBy and ParameterSupplier
  • partial mock / Spying objects
  • persistence logic
    • unit testing / Unit testing the persistence logic
  • PhoneBookDerbyDao class / Simplifying persistence with Spring
  • PMD plugin
    • URL / Working with the PMD plugin
    • working with / Working with the PMD plugin
  • PMD tool / Understanding the static code analysis
  • POM file
    • about / The Project Object Model (POM) file
  • PotentialAssignment class / Externalizing data using @ParametersSuppliedBy and ParameterSupplier
  • PowerMock / Mocking objects
  • PowerMockito / Mocking objects
  • private methods
    • working with / Working with private methods
  • process, building blocks / Separating concerns

Q

  • quality
    • improving, with Sonar Eclipse plugin / Improving quality with the Sonar Eclipse plugin
    • monitoring, with Gradle and SonarQube / Monitoring quality with Gradle and SonarQube, Monitoring quality with Maven and SonarQube
    • monitoring, with Ant and SonarQube / Monitoring quality with Ant and SonarQube
    • monitoring, with SonarQube and Ant / Monitoring quality with Ant and SonarQube
  • Quality Assurance (QA) / Working with greenfield code

R

  • @RunWith annotation / Exploring the @RunWith annotation
  • reset method / Resetting mock objects
  • retrieveEncounters() method / Removing the test logic from the production code
  • RETURNS_DEFAULTS setting / Changing the default settings
  • RETURNS_MOCKS setting / Changing the default settings
  • RETURNS_SMART_NULLS setting / Changing the default settings
  • runtime dependencies / The Java plugin

S

  • sanity check / Defining unit testing
  • selling point (USP) / Gradle automation
  • SingletonDependency class / Exploring static method issues
  • site life cycle, Maven / The site life cycle
  • SONAR / Learning assumptions
  • sonar*sonar command / Monitoring quality with Maven and SonarQube
  • Sonar Eclipse plugin
    • used, for quality improvement / Improving quality with the Sonar Eclipse plugin
    • download, URL / Improving quality with the Sonar Eclipse plugin
  • SonarQube
    • about / Monitoring code quality with SonarQube
    • features / Monitoring code quality with SonarQube
    • configuring, steps / Running SonarQube
    • URL / Running SonarQube
    • quality, monitoring with Gradle / Monitoring quality with Gradle and SonarQube
    • quality, monitoring with Maven / Monitoring quality with Maven and SonarQube
    • quality, monitoring with Ant / Monitoring quality with Ant and SonarQube
    • and ANT, used for quality monitoring / Monitoring quality with Ant and SonarQube
  • SonarQube runner
    • used, for code analyzation / Analyzing code with the SonarQube runner
  • Spring
    • used, for integration test writing / Writing integration tests with Spring
  • Spring JDBC
    • implementing, steps / Simplifying persistence with Spring
  • Spring MVC
    • request handling mechanism / Playing with Spring MVC
    • about / Playing with Spring MVC
    • Spring web application, building / Playing with Spring MVC
  • spy / Spy
  • spy object / Spying objects
  • StaticBlockOwner class / Exploring static variables and blocks
  • static code analysis
    • about / Understanding the static code analysis
    • metrics / Understanding the static code analysis
    • automated tools / Understanding the static code analysis
  • static methods
    • about / Exploring static method issues
  • string matchers
    • startsWith matcher / Exploring string matchers – startsWith, endsWith, and containsString
    • endsWith matcher / Exploring string matchers – startsWith, endsWith, and containsString
    • containsString matcher / Exploring string matchers – startsWith, endsWith, and containsString
  • stub / Stub
  • Subtask
    • ordering, doFirst used / Ordering subtasks using doFirst and doLast
    • ordering, doLast used / Ordering subtasks using doFirst and doLast
  • SurveyResultCompiler class / Working with greenfield code

T

  • @Theory annotation / Exploring JUnit theories
  • target folder
    • cobertura / Working with the Maven Cobertura plugin
    • generated-classes / Working with the Maven Cobertura plugin
    • site / Working with the Maven Cobertura plugin
    • surefire-reports / Working with the Maven Cobertura plugin
  • task
    • about / Gradling
    • executing / Gradling
    • creating / Gradling
    • subtasks / Ordering subtasks using doFirst and doLast
    • default tasks / Default tasks
    • dependency / The task dependency
    • --daemon option / Daemon
    • daemon process / Daemon
  • TDD
    • about / Defining unit testing
    • life cycle / Working with greenfield code
    • benefits / Working with greenfield code
  • TemporaryFolder rule
    • unfolding / Unfolding the TemporaryFolder rule
  • test
    • about / Defining unit testing
    • ignoring / Ignoring a test
    • executing, in order / Executing tests in order
  • Test-Driven Development (TDD) / Benefits of CI
  • testability design
    • constructor issues, identifying / Identifying constructor issues
    • initialization issues, realizing / Realizing initialization issues
    • class-level variable initialization, overcoming options / Realizing initialization issues
    • private methods, working with / Working with private methods
    • final methods, working with / Working with final methods
    • static method issues / Exploring static method issues
    • final classes, working with / Working with final classes
    • new operator / Learning the new attribute
    • static variables / Exploring static variables and blocks
    • static block / Exploring static variables and blocks
  • testCompile dependencies / The Java plugin
  • test configuration
    • unit tests, benefits / Configuring tests
    • principles / Configuring tests
    • in-memory tests, running / Running in-memory tests
    • Thread.sleep, using / Staying away from Thread.sleep
    • unit tests, separating from production code / Keeping unit tests away from the production code
    • static variables, avoiding / Avoiding static variables
    • test execution order, assuming / Assuming the test execution order, Refactoring over engineered tests
    • data, loading from files / Loading data from files
    • super.setUp(), invoking / Invoking super.setUp() and super.tearDown()
    • super.tearDown(), invoking / Invoking super.setUp() and super.tearDown()
    • side effects, avoiding / Staying away from side effects
    • locales, working with / Working with locales
    • dates, working with / Working with dates
  • test control logic
    • refactoring / Refactoring the test control logic
  • test doubles, category
    • dummy / Dummy
    • stub / Stub
    • fake / Fake
    • mock / Mock
    • spy / Spy
  • testing impediment
    • showing / Designing for testability
  • testing logic
    • inserting, into production code / Removing the test logic from the production code
  • testMe() method / Learning the new attribute
  • Test method / Refactoring the test control logic
  • TestName rule
    • working with / Working with the TestName rule
  • testRuntime dependencies / The Java plugin
  • tests
    • writing, best practices / Writing meaningful tests, Improving readability, Ignoring simple test cases, Relying on direct testing, Staying away from debugging, Avoiding generic matchers, Keeping away from @ignore
  • test smells
    • duplicates, refactoring / Refactoring duplicates
    • test control logic, refactoring / Refactoring the test control logic
    • test logic, removing from production code / Removing the test logic from the production code
    • engineered tests, refactoring / Refactoring over engineered tests
  • test suite
    • exploring / Exploring the test suite
  • TestWatcher rule / Learning the TestWatcher rule
  • thenAnswer(Answer answer) method / Stubbing methods
  • thenCallRealMethod() method / Stubbing methods
  • thenReturn(x) method / Stubbing methods
  • thenReturn method / Stubbing void methods
  • thenThrow(x) method / Stubbing methods
  • Theories annotation / Exploring JUnit theories
  • ticket booking logic / Working with testing impediments
  • Time Machine view / Analyzing code with the SonarQube runner
  • timeout rule
    • playing with / Playing with the timeout rule
  • timeouts
    • working with / Working with timeouts
  • times(int wantedNumberOfInvocations) method / Verifying in depth

U

  • unit test, principles
    • Order independent and isolated / Qualities of unit testing
    • trouble-free setup and run / Qualities of unit testing
    • effortless execution / Qualities of unit testing
    • Formula 1 execution / Qualities of unit testing
  • unit testing
    • about / Defining unit testing, Writing meaningful tests
    • code-driven unit frameworks, for Java / Defining unit testing
    • code, impediments / Working with testing impediments
  • unit tests
    • about / Working with testing impediments

V

  • Verifier rule
    • working with / Working with the Verifier rule
  • verify() method / Stubbing methods, Verifying in depth
  • verifyNoMoreInteractions(Object... mocks) method / Verifying zero and no more interactions
  • verifyZeroInteractions(Object... mocks) method / Verifying zero and no more interactions
  • void methods
    • stubbing / Stubbing void methods

W

  • what, building blocks / Separating concerns
  • when_ten_percent_gain_then_the_stock_is_sold method / Stubbing methods
  • who, building blocks / Separating concerns
  • wildcard matchers / Why do we need wildcard matchers?
  • willAnswer method / The BDD syntax
  • willCallRealMethod() method / The BDD syntax
  • will method / The BDD syntax
  • willReturn method / The BDD syntax
  • willThrow method / The BDD syntax

X

  • XML namespaces / Monitoring quality with Ant and SonarQube
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 €14.99/month. Cancel anytime
Visually different images