123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import org.junit.Assert;
  2. import org.junit.Before;
  3. import org.junit.Test;
  4. public class IntegerPrinterTest {
  5. IntegerPrinter integerPrinter;
  6. @Before
  7. public void setUp(){
  8. integerPrinter = new IntegerPrinter();
  9. }
  10. @Test
  11. public void printIntegerAsBinaryTest(){
  12. //:Given
  13. String expected = "111110100";
  14. //:When
  15. String actual = integerPrinter.printIntegerAsBinary(500);
  16. //:Then
  17. Assert.assertEquals("The value equals 111110100", expected, actual);
  18. }
  19. @Test
  20. public void printIntegerAsHexadecimal(){
  21. //:Given
  22. String expected = "1f4";
  23. //:When
  24. String actual = integerPrinter.printIntegerAsHexadecimal(500);
  25. //:Then
  26. Assert.assertEquals("The value equals 1f4", expected, actual);
  27. }
  28. @Test
  29. public void printIntegerAsOctalTest(){
  30. //:Given
  31. String expected = "764";
  32. //:When
  33. String actual = integerPrinter.printIntegerAsOctal(500);
  34. //:Then
  35. Assert.assertEquals("The value equals 764", expected, actual);
  36. }
  37. }