Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Question Test Driven Development (TDD) is a popular Software Engineering practice where developers write tests first before writing code. For this problem, you will

JAVA Question

Test Driven Development (TDD) is a popular Software Engineering practice where developers write tests first before writing code. For this problem, you will be creating test cases for classes that implement the interface described below:

public interface NumberFormatter

{

String format(int n);

}

Consider three classes that implement this interface. A DecimalSeparatorFormatter formats an integer with decimal separators; for example, one million as 1,000,000. An AccountingFormatter formats negative numbers with parentheses; for example, 1 as (1). A BaseFormatter formats the number in base n, where n is any number between 2 and 36 that is provided in the constructor (i.e, the constructor in the BaseFormatter class takes one integer parameter that specifies the base to be used for conversion). Write a test class called NumberFormatterTests that includes test cases for the above-mentioned three classes. Sample expected output is given below:

DecimalSeparatorFormatter

38756 -> 38,756

956432 -> 956,432

AccountingFormatter

-987654321 -> (987654321)

-287 -> (287)

BaseFormatter

100 -> 100 [Base 10]

21 -> 10101 [Base 2]

1194684 -> 123ABC [Base 16]

Write test cases for valid and invalid input.

You are NOT expected to write the corresponding classes. Your grade will be determined based on the extent to which your test cases pass against the code that the TAs will use for grading. You will not have access to this code.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

More Books

Students also viewed these Databases questions

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago