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
Learning Java Functional Programming

You're reading from   Learning Java Functional Programming Create robust and maintainable Java applications using the functional style of programming

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher
ISBN-13 9781783558483
Length 296 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (2):
Arrow left icon
Richard M. Reese Richard M. Reese
Author Profile Icon Richard M. Reese
Richard M. Reese
Richard M Reese Richard M Reese
Author Profile Icon Richard M Reese
Richard M Reese
Arrow right icon
View More author details
Toc

Table of Contents (11) Chapters Close

Preface 1. Getting Started with Functional Programming 2. Putting the Function in Functional Programming FREE CHAPTER 3. Function Composition and Fluent Interfaces 4. Streams and the Evaluation of Expressions 5. Recursion Techniques in Java 8 6. Optional and Monads 7. Supporting Design Patterns Using Functional Programming 8. Refactoring, Debugging, and Testing 9. Bringing It All Together Index

Testing functional programs


Testing is a complex yet important aspect of software development. Java 8 has impacted how testing can be conducted. The intent of this section is not to explore all of the possible ways of testing Java 8 code, but to provide some insight into possible testing approaches.

JUnit is the standard for testing Java applications and is used to test the functional aspects of Java. Typically, a JUnit test is created to test a method by passing it data and comparing the return value to determine if the method executed properly. In this section, we will examine various testing approaches.

Testing lambda expressions

A significant consideration is whether to test a lambda expression at all. If it is too simple to break, then there is no need to test it. The question is, what is too simple? The answer to this depends on the situation. A simple lambda expression, such as, n -> 2*n, is easy to understand and probably not worth the effort to test it. However, a more complicated...

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