Time to put our programming hats on. We will start with the very first test. It is very important to understand the acceptance criteria before we make a start on the test. Our test will be documenting our understanding of the scenario.
In the normal course of events at this stage, if there are any questions about the scenario, they will need to be cleared up with end user or any representation of the end user.
Let's start with the first test. Create a Scala file DecimalBinarySpec.scala
for the test under the com.packt
package inside src/test/scala
as given here:
package com.packt import org.scalatest.FlatSpec class DecimalBinarySpec extends FlatSpec{ "base conversion utility" should "convert a number 99 into a binary number 1100011" in { var binary:Binary = BaseConversion.decimalToBinary(Decimal("99")) assert(binary.number == "1100011") } }
While writing this test in your IDE, you will note that...