Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Test-Driven Java Development

You're reading from   Test-Driven Java Development Invoke TDD principles for end-to-end application development with Java

Arrow left icon
Product type Paperback
Published in Aug 2015
Publisher Packt
ISBN-13 9781783987429
Length 284 pages
Edition 1st Edition
Languages
Arrow right icon
Toc

Table of Contents (12) Chapters Close

Preface 1. Why Should I Care for Test-driven Development? FREE CHAPTER 2. Tools, Frameworks, and Environments 3. Red-Green-Refactor – from Failure through Success until Perfection 4. Unit Testing – Focusing on What You Do and Not on What Has Been Done 5. Design – If It's Not Testable, It's Not Designed Well 6. Mocking – Removing External Dependencies 7. BDD – Working Together with the Whole Team 8. Refactoring Legacy Code – Making it Young Again 9. Feature Toggles – Deploying Partially Done Features to Production 10. Putting It All Together Index

Developing Tic-Tac-Toe v2


We'll continue where we left off with Tic-Tac-Toe in Chapter 3, Red-Green-Refactor: From Failure Through Success until Perfection. The complete source code of the application developed so far can be found at https://bitbucket.org/vfarcic/tdd-java-ch06-tic-tac-toe-mongo.git. Use the VCS | Checkout from Version Control | Git option from the IntelliJ IDEA to clone the code. As with any other project, the first thing we need to do is add the dependencies to build.gradle:

dependencies {
    compile 'org.jongo:jongo:1.1'
    compile 'org.mongodb:mongo-java-driver:2.+'
    testCompile 'junit:junit:4.11'
    testCompile 'org.mockito:mockito-all:1.+'
}

Importing the MongoDB driver should be self-explanatory. Jongo is a very helpful set of utility methods that make working with Java code in a way much more similar to the Mongo query language. For the testing part, we'll continue using JUnit with an addition of Mockito mocks, spies, and validations.

You'll notice that we won...

lock icon The rest of the chapter is locked
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 $19.99/month. Cancel anytime