Mockito for Spring
eBook - ePub

Mockito for Spring

Sujoy Acharya

Partager le livre
  1. 178 pages
  2. English
  3. ePUB (adapté aux mobiles)
  4. Disponible sur iOS et Android
eBook - ePub

Mockito for Spring

Sujoy Acharya

DĂ©tails du livre
Aperçu du livre
Table des matiĂšres
Citations

Foire aux questions

Comment puis-je résilier mon abonnement ?
Il vous suffit de vous rendre dans la section compte dans paramĂštres et de cliquer sur « RĂ©silier l’abonnement ». C’est aussi simple que cela ! Une fois que vous aurez rĂ©siliĂ© votre abonnement, il restera actif pour le reste de la pĂ©riode pour laquelle vous avez payĂ©. DĂ©couvrez-en plus ici.
Puis-je / comment puis-je télécharger des livres ?
Pour le moment, tous nos livres en format ePub adaptĂ©s aux mobiles peuvent ĂȘtre tĂ©lĂ©chargĂ©s via l’application. La plupart de nos PDF sont Ă©galement disponibles en tĂ©lĂ©chargement et les autres seront tĂ©lĂ©chargeables trĂšs prochainement. DĂ©couvrez-en plus ici.
Quelle est la différence entre les formules tarifaires ?
Les deux abonnements vous donnent un accĂšs complet Ă  la bibliothĂšque et Ă  toutes les fonctionnalitĂ©s de Perlego. Les seules diffĂ©rences sont les tarifs ainsi que la pĂ©riode d’abonnement : avec l’abonnement annuel, vous Ă©conomiserez environ 30 % par rapport Ă  12 mois d’abonnement mensuel.
Qu’est-ce que Perlego ?
Nous sommes un service d’abonnement Ă  des ouvrages universitaires en ligne, oĂč vous pouvez accĂ©der Ă  toute une bibliothĂšque pour un prix infĂ©rieur Ă  celui d’un seul livre par mois. Avec plus d’un million de livres sur plus de 1 000 sujets, nous avons ce qu’il vous faut ! DĂ©couvrez-en plus ici.
Prenez-vous en charge la synthÚse vocale ?
Recherchez le symbole Écouter sur votre prochain livre pour voir si vous pouvez l’écouter. L’outil Écouter lit le texte Ă  haute voix pour vous, en surlignant le passage qui est en cours de lecture. Vous pouvez le mettre sur pause, l’accĂ©lĂ©rer ou le ralentir. DĂ©couvrez-en plus ici.
Est-ce que Mockito for Spring est un PDF/ePUB en ligne ?
Oui, vous pouvez accĂ©der Ă  Mockito for Spring par Sujoy Acharya en format PDF et/ou ePUB ainsi qu’à d’autres livres populaires dans Informatique et DĂ©veloppement de logiciels. Nous disposons de plus d’un million d’ouvrages Ă  dĂ©couvrir dans notre catalogue.

Informations

Année
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,...

Table des matiĂšres