O'Reilly logo

Scala Test-Driven Development by Gaurav Sood

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Problem statement

We will extend our example from the previous chapter about base conversion so that we can convert from decimal to hexadecimal and vice versa.

Feature – decimal to hexadecimal conversion

As a user, I want to convert a decimal number to a hexadecimal number.

Scenario 1:

  • Given a decimal number A
  • When I convert this number to a hexadecimal number
  • Then, I get a hexadecimal equivalent B of the original decimal number

Scenario 2:

  • Given a hexadecimal number X
  • When I convert this number to a decimal number
  • Then, I get decimal equivalent Y of the original hexadecimal number

Scenario 3:

  • Given a decimal number A
  • When I convert A to hexadecimal to get hexadecimal number B
  • And I again convert B to decimal number C
  • Then, A is equal to C

Let's apply some ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required