SwitchDisplayTest.java 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import static org.junit.Assert.*;
  2. import org.junit.After;
  3. import org.junit.Before;
  4. import org.junit.Test;
  5. /**
  6. * The test class SwitchDisplayTest.
  7. *
  8. * @author (your name)
  9. * @version (a version number or a date)
  10. */
  11. public class SwitchDisplayTest
  12. {
  13. /**
  14. * Default constructor for test class SwitchDisplayTest
  15. */
  16. public SwitchDisplayTest()
  17. {
  18. }
  19. /**
  20. * Sets up the test fixture.
  21. *
  22. * Called before every test case method.
  23. */
  24. @Before
  25. public void setUp()
  26. {
  27. }
  28. /**
  29. * Tears down the test fixture.
  30. *
  31. * Called after every test case method.
  32. */
  33. @After
  34. public void tearDown()
  35. {
  36. }
  37. @Test
  38. public void toBinary()
  39. {
  40. SwitchDisplay switchDi1 = new SwitchDisplay();
  41. assertEquals("101101", switchDi1.toBinary(45));
  42. }
  43. @Test
  44. public void toOctal()
  45. {
  46. SwitchDisplay switchDi1 = new SwitchDisplay();
  47. assertEquals("55", switchDi1.toOctal(45));
  48. }
  49. @Test
  50. public void toHexa()
  51. {
  52. SwitchDisplay switchDi1 = new SwitchDisplay();
  53. assertEquals("2d", switchDi1.toHexa(45));
  54. }
  55. @Test
  56. public void toDecimal()
  57. {
  58. SwitchDisplay switchDi1 = new SwitchDisplay();
  59. assertEquals("45", switchDi1.toDecimal(45));
  60. }
  61. }