Rating
0.00

Scala

Scala is an object-functional programming and scripting language for general software applications, statically typed, designed to concisely express solutions in an elegant, type-safe and low ceremonial manner.

  • +1
This article may be considered as a continuation of Introduction to Writing Tests with ScalaTest. In this post I would like to talk about ScalaMock.

Mocking is a technique by which you can test code without requiring all of its dependencies in place. Java offers several frameworks for mocking objects when writing tests. The most well known are JMock, EasyMock, and Mockito. As the Scala language introduces new elements such as traits and functions, the Java-based mocking frameworks are not enough, and this is where ScalaMock comes into play.

Read more →
  • 0
When constructing “enterprise” systems it often turns out that ValueObjects (or case classes) are created. They store information about some instance of entity that is processed by the system. For example:

case class Person(name: String, address: Address)

This way of data representation in the system has two major strengths:

  • Strictly typed access to the data;
  • Capability of meta information binding to features with the help of annotations.

And drawbacks:

Read more →
  • +1
To be able to quickly start visualizing some of the tests that can be written with ScalaTest, we can take advantage of the test-patterns-scala template from the Typesafe Activator. It consists of a number of examples that essentially target the ScalaTest framework. The easiest way to get the code is to download the template bundle for test-patterns-scala. An archive contains a bootstrap script that can simplify our life's by starting Activator automatically.

Setting up the test-patterns-scala activator project only requires you to go to the directory where you installed the Typesafe Activator and then, either start the GUI through the > activator ui command, or type > activator new to create a new project and select the appropriate template when prompted.

Read more →