LEADER 05346nam 2200673 450 001 9910820997203321 005 20200520144314.0 010 $a1-78398-275-6 035 $a(CKB)2550000001321689 035 $a(EBL)1719576 035 $a(SSID)ssj0001328523 035 $a(PQKBManifestationID)11777210 035 $a(PQKBTitleCode)TC0001328523 035 $a(PQKBWorkID)11303294 035 $a(PQKB)10351164 035 $a(Au-PeEL)EBL1719576 035 $a(CaPaEBR)ebr10887665 035 $a(CaONFJC)MIL621121 035 $a(OCoLC)882611110 035 $a(CaSebORM)9781783982745 035 $a(MiAaPQ)EBC1719576 035 $a(PPN)228044928 035 $a(EXLCZ)992550000001321689 100 $a20140711h20142014 uy 0 101 0 $aeng 135 $aur|n|---||||| 181 $ctxt 182 $cc 183 $acr 200 10$aMockito cookbook $eover 65 recipes to get you up and running with unit testing using Mockito /$fMarcin Grzejszczak ; cover image by Poonam Nayak 205 $a1st edition 210 1$aBirmingham, [England] :$cPackt Publishing,$d2014. 210 4$dİ2014 215 $a1 online resource (284 p.) 300 $a"Quick answers to common problems"--Cover. 300 $aIncludes index. 311 $a1-78398-274-8 311 $a1-306-89870-6 327 $aCover; Copyright; Credits; About the Author; About the Reviewers; www.PacktPub.com; Table of Contents; Preface; Chapter 1: Getting Started with Mockito; Introduction; Adding Mockito to a project's classpath; Getting started with Mockito for JUnit; Getting started with Mockito for TestNG; Mockito best practices - test behavior not implementation; Adding Mockito hints to exception messages (JUnit) (Experimental); Adding additional Mockito warnings to your tests (JUnit) (Experimental); Chapter 2: Creating Mocks; Introduction; Creating mocks in code; Creating mocks with annotations 327 $aCreating mocks with a different default answerCreating mocks with different default answers with annotations; Creating mocks with custom configuration; Creating mocks of final classes with PowerMock; Creating mocks of enums with PowerMock; Chapter 3: Creating Spies and Partial Mocks; Introduction; Creating spies in code; Creating spies with custom configuration; Creating spies using annotations; Creating partial mocks; Creating partial mocks of final classes with delegatesTo(); Creating spies of final classes with PowerMock; Chapter 4: Stubbing Behavior of Mocks; Introduction 327 $aUsing argument matchers for stubbingStubbing methods that return values; Stubbing methods so that they throw exceptions; Stubbing methods so that they return custom answers; Stubbing methods so that they call real methods; Stubbing void methods; Stubbing void methods so that they throw exceptions; Stubbing void methods so that they return custom answers; Stubbing void methods so that they call real methods; Stubbing final methods with PowerMock; Stubbing static methods with PowerMock; Stubbing object instantiation using PowerMock; Chapter 5: Stubbing Behavior of Spies; Introduction 327 $aStubbing methods that return valuesStubbing methods so that they throw exceptions; Stubbing methods so that they return custom answers; Stubbing void methods; Stubbing void methods so that they throw exceptions; Stubbing void methods so that they return custom answers; Stubbing final methods with PowerMock; Chapter 6: Verifying Test Doubles; Introduction; Verifying the method invocation count with times(); Verifying the method invocation count with atLeast(); Verifying the method invocation count with atMost(); Verifying that interactions never happened 327 $aVerifying that interactions stopped happeningVerifying the order of interactions; Verifying interactions and ignoring stubbed methods; Verifying the method invocation within time; Chapter 7: Verifying Behavior with Object Matchers; Introduction; Using Hamcrest matchers for assertions; Creating custom Hamcrest matchers; Using Hamcrest matchers for stubbing and verification; Using AssertJ for assertions; Creating custom AssertJ assertions; Capturing and asserting the argument; Chapter 8: Refactoring with Mockito; Introduction; Removing the problems with instance creation 327 $aRefactoring classes that do too much 330 $aThis is a focused guide with lots of practical recipes with presentations of business issues and presentation of the whole test of the system. This book shows the use of Mockito's popular unit testing frameworks such as JUnit, PowerMock, TestNG, and so on. If you are a software developer with no testing experience (especially with Mockito) and you want to start using Mockito in the most efficient way then this book is for you. This book assumes that you have a good knowledge level and understanding of Java-based unit testing frameworks. 606 $aComputer interfaces 606 $aUser interfaces (Computer systems) 615 0$aComputer interfaces. 615 0$aUser interfaces (Computer systems) 676 $a621.3981 700 $aGrzejszczak$b Marcin$01643471 702 $aNayak$b Poonam 801 0$bMiAaPQ 801 1$bMiAaPQ 801 2$bMiAaPQ 906 $aBOOK 912 $a9910820997203321 996 $aMockito cookbook$93988747 997 $aUNINA