123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import org.junit.Assert;
- import org.junit.Before;
- import org.junit.Test;
-
- public class IntegerPrinterTest {
-
- IntegerPrinter integerPrinter;
-
- @Before
- public void setUp(){
- integerPrinter = new IntegerPrinter();
- }
-
- @Test
- public void printIntegerAsBinaryTest(){
- //:Given
- String expected = "111110100";
-
- //:When
- String actual = integerPrinter.printIntegerAsBinary(500);
-
- //:Then
- Assert.assertEquals("The value equals 111110100", expected, actual);
- }
-
- @Test
- public void printIntegerAsHexadecimal(){
- //:Given
- String expected = "1f4";
-
- //:When
- String actual = integerPrinter.printIntegerAsHexadecimal(500);
-
- //:Then
- Assert.assertEquals("The value equals 1f4", expected, actual);
- }
-
- @Test
- public void printIntegerAsOctalTest(){
- //:Given
- String expected = "764";
-
- //:When
- String actual = integerPrinter.printIntegerAsOctal(500);
-
- //:Then
- Assert.assertEquals("The value equals 764", expected, actual);
- }
-
- }
|