Mockito for Spring
eBook - ePub

Mockito for Spring

Sujoy Acharya

Condividi libro
  1. 178 pagine
  2. English
  3. ePUB (disponibile sull'app)
  4. Disponibile su iOS e Android
eBook - ePub

Mockito for Spring

Sujoy Acharya

Dettagli del libro
Anteprima del libro
Indice dei contenuti
Citazioni

Domande frequenti

Come faccio ad annullare l'abbonamento?
È semplicissimo: basta accedere alla sezione Account nelle Impostazioni e cliccare su "Annulla abbonamento". Dopo la cancellazione, l'abbonamento rimarrà attivo per il periodo rimanente già pagato. Per maggiori informazioni, clicca qui
È possibile scaricare libri? Se sì, come?
Al momento è possibile scaricare tramite l'app tutti i nostri libri ePub mobile-friendly. Anche la maggior parte dei nostri PDF è scaricabile e stiamo lavorando per rendere disponibile quanto prima il download di tutti gli altri file. Per maggiori informazioni, clicca qui
Che differenza c'è tra i piani?
Entrambi i piani ti danno accesso illimitato alla libreria e a tutte le funzionalità di Perlego. Le uniche differenze sono il prezzo e il periodo di abbonamento: con il piano annuale risparmierai circa il 30% rispetto a 12 rate con quello mensile.
Cos'è Perlego?
Perlego è un servizio di abbonamento a testi accademici, che ti permette di accedere a un'intera libreria online a un prezzo inferiore rispetto a quello che pagheresti per acquistare un singolo libro al mese. Con oltre 1 milione di testi suddivisi in più di 1.000 categorie, troverai sicuramente ciò che fa per te! Per maggiori informazioni, clicca qui.
Perlego supporta la sintesi vocale?
Cerca l'icona Sintesi vocale nel prossimo libro che leggerai per verificare se è possibile riprodurre l'audio. Questo strumento permette di leggere il testo a voce alta, evidenziandolo man mano che la lettura procede. Puoi aumentare o diminuire la velocità della sintesi vocale, oppure sospendere la riproduzione. Per maggiori informazioni, clicca qui.
Mockito for Spring è disponibile online in formato PDF/ePub?
Sì, puoi accedere a Mockito for Spring di Sujoy Acharya in formato PDF e/o ePub, così come ad altri libri molto apprezzati nelle sezioni relative a Informatique e Développement de logiciels. Scopri oltre 1 milione di libri disponibili nel nostro catalogo.

Informazioni

Anno
2015
ISBN
9781783983780

Mockito for Spring


Table of Contents

Mockito for Spring
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Getting Familiar with the Spring Framework
Getting started with Spring
Exploring the Spring architecture
The core container
The AOP module
The instrumentation module
The messaging module
The data access module
The web layer
The test module
Learning the Inversion of Control
Printing Hello World
Examining life cycle messages
Working with autowiring and annotations
Working with aspects
Exploring Spring JDBC
Handling a transaction with Spring
Working with declarative Spring transaction
Exploring transaction attributes
Using the @Transactional annotation
Working with a programmatic Spring transaction
Using TransactionTemplate
Using PlatformTransactionManager
Building an MVC application with Spring
Summary
2. Working with JUnit and Mockito
Learning unit testing
Working with the JUnit framework
Configuring Eclipse
Examining annotations
Verifying an expectation with an assertion
Examining exception handling
Working with the @RunWith annotation
Working with test suites
Working with assertThat
Exploring equalTo, is, and not
Exploring compound matchers – either, both, anyOf, and allOf
Exploring collection matchers – hasItem and hasItems
Working with string matchers – startsWith, endsWith, and containsString
Exploring custom matchers
Working with Mockito
Learning the significance of Mockito
Exploring Mockito
Configuring Mockito
Mocking in action
Mocking objects
Stubbing methods
Verifying in depth
Verifying zero and no more interactions
Throwing exceptions
Summary
3. Working with Spring Tests
Exploring the TestContext framework
Writing a custom TestExecutionListener interface
Configuring Spring profiles
Mocking an environment
Mocking the JNDI lookup
Using ReflectionTestUtils
Working with annotations
Testing Spring MVC
Mocking the servlet container with MockMvc
Handling transactions in Spring tests
Summary
4. Resolving Out-of-container Dependencies with Mockito
Unit testing the web layer
Unit testing the service layer
Unit testing the data access layer
Summary
5. Time Travelling with Spring
Discovering the new Spring release
Working with asynchronous tasks
Exploring @RestController
Learning AsyncRestTemplate
Caching objects
Summary
Index

Mockito for Spring

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: February 2015
Production reference: 1200215
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-378-0
www.packtpub.com

Credits

Author
Sujoy Acharya
Reviewers
Carlo Micieli
Gualtiero Testa
Commissioning Editor
Amarabha Banerjee
Acquisition Editor
Llewellyn Rozario
Content Development Editor
Parita Khedekar
Technical Editors
Manal Pednekar
Chinmay S. Puranik
Copy Editors
Dipti Kapadia
Deepa Nambiar
Vikrant Phadke
Project Coordinator
Milton Dsouza
Proofreaders
Martin Diver
Maria Gould
Paul Hindle
Indexer
Monica Ajmera Mehta
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat

About the Author

Sujoy Acharya works as a software architect with Siemens Technology and Services Pvt. Ltd. (STS). He grew up in a joint family and pursued his graduation in the fields of computer science and engineering. His hobbies are watching movies and sitcoms, playing outdoor sports, and reading books.
Sujoy likes to research upcoming technologies. His major contributions are in the fields of Java, J2EE, SOA, Ajax, GWT, and the Spring Framework.
He has authored three books for Packt Publishing, namely Test-Driven Development with Mockito, Mastering Unit Testing using Mockito and JUnit, and Mockito Essentials.
He designs and develops healthcare software products. He has over 11 years of experience in the industry and has architected and implemented large-scale enterprise solutions.

About the Reviewers

Carlo Micieli has been a software developer since 2001, developing applications for computer-aided manufacturing with C#.
His main area of interest is application life cycle management, with a strong focus on topics such as software design and testing.
He is a programming languages enthusiast, and he's currently trying to learn Scala and Haskell. He shares his experiments on GitHub (http://github.com/CarloMicieli).
Gualtiero Testa is a software analyst, architect, and developer involved in Java enterprise-level web applications, mainly in the domains of banking, health, and government agencies. He lives in Pavia, Italy.
His main interests are test-driven development (TDD), testing tools and methodologies, and everything related to code quality.
You can reach him through his blog at http://www.gualtierotesta.it/.

www.PacktPub.com

Support files, eBooks, discount offers, and more

For support files and downloads related to your book,...

Indice dei contenuti