Book Image

Learn Scala Programming

By : Slava Schmidt
Book Image

Learn Scala Programming

By: Slava Schmidt

Overview of this book

The second version of Scala has undergone multiple changes to support features and library implementations. Scala 2.13, with its main focus on modularizing the standard library and simplifying collections, brings with it a host of updates. Learn Scala Programming addresses both technical and architectural changes to the redesigned standard library and collections, along with covering in-depth type systems and first-level support for functions. You will discover how to leverage implicits as a primary mechanism for building type classes and look at different ways to test Scala code. You will also learn about abstract building blocks used in functional programming, giving you sufficient understanding to pick and use any existing functional programming library out there. In the concluding chapters, you will explore reactive programming by covering the Akka framework and reactive streams. By the end of this book, you will have built microservices and learned to implement them with the Scala and Lagom framework.
Table of Contents (19 chapters)

Introduction to property-based testing

The concept of unit testing should be well-known by any professional developer. A unit test usually contains a number of test cases. Each test case describes the expected behavior of a part of the program. The description is usually formulated in the form: for this unit of code in that specific state we expect given input to produce the following output. The developer then replicates such test cases with some deviations in the initial state and/or input data and expectations of the result in order to cover different code paths.

The specification of the test case is represented in the form of a test code relying on a testing framework. As at the moment of this writing, there are two popular testing frameworks for Scala projects, ScalaTest and Specs2. It is arguable that at least one of them should be familiar to any Scala developer, so we...