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
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Testing with JUnit

You're reading from   Testing with JUnit Master high quality software development driven by unit tests

Arrow left icon
Product type Paperback
Published in Aug 2015
Publisher
ISBN-13 9781782166603
Length 200 pages
Edition 1st Edition
Tools
Arrow right icon
Authors (2):
Arrow left icon
Leonard Przybylski Leonard Przybylski
Author Profile Icon Leonard Przybylski
Leonard Przybylski
Frank Appel Frank Appel
Author Profile Icon Frank Appel
Frank Appel
Arrow right icon
View More author details
Toc

Understanding isolation


As we've just learned, a component under test usually has to collaborate with other components. But why can this be a problem with respect to unit tests, and what are we going to do about it? This section will explain the necessity of testing functionality in isolation. Afterwards, it introduces the so-called test doubles, which we will use later on to achieve this goal.

Delegating responsibilities to DOCs

Now that we've got a pretty good understanding of the timeline's responsibilities, we want to go ahead with development. As we may consider fetching items from a provider as the most valuable functionality on our way to a minimal viable product, [MIVIPR] we decide to continue with page wise fetching.

But we know that a Timeline component relies on an ItemProvider instance to make this happen. To implement this dependency, we could choose constructor injection. Indeed, this binds a certain provider statically to a timeline instance, but it avoids any component reinitialization...

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
Banner background image