Write bunch of java to solve a series of requirements and pass a series of tests to prove your code works the way it should.

WriteIFsTest.java 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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 WriteIFsTest.
  7. *
  8. * @author kyounger
  9. * @version 1.2
  10. */
  11. public class WriteIFsTest
  12. {
  13. private static final double _0_5 = 0.5;
  14. private static final double _0_04 = 0.04;
  15. /**
  16. * Default constructor for test class WriteIFsTest
  17. */
  18. public WriteIFsTest()
  19. {
  20. }
  21. /**
  22. * Sets up the test fixture.
  23. *
  24. * Called before every test case method.
  25. */
  26. @Before
  27. public void setUp()
  28. {
  29. }
  30. /**
  31. * Tears down the test fixture.
  32. *
  33. * Called after every test case method.
  34. */
  35. @After
  36. public void tearDown()
  37. {
  38. }
  39. @Test
  40. public void TestIfs()
  41. {
  42. WriteIFs writeIFs1 = new WriteIFs();
  43. writeIFs1.playerDied(true);
  44. assertEquals("Game Over!", writeIFs1.ss);
  45. }
  46. @Test
  47. public void TestTherm()
  48. {
  49. WriteIFs writeIFs1 = new WriteIFs();
  50. assertEquals("heating", writeIFs1.thermoSTAT(62));
  51. }
  52. @Test
  53. public void TestTherm1()
  54. {
  55. WriteIFs writeIFs1 = new WriteIFs();
  56. assertEquals("cooling", writeIFs1.thermoSTAT(81));
  57. }
  58. @Test
  59. public void TestCheckFuel1()
  60. {
  61. WriteIFs writeIFs1 = new WriteIFs();
  62. writeIFs1.checkFuel(_0_5);
  63. assertEquals(0, writeIFs1.x);
  64. }
  65. @Test
  66. public void TestCheckFuel2()
  67. {
  68. WriteIFs writeIFs1 = new WriteIFs();
  69. writeIFs1.checkFuel(_0_04);
  70. assertEquals(99, writeIFs1.x);
  71. }
  72. @Test
  73. public void TestFireControl()
  74. {
  75. WriteIFs writeIFs1 = new WriteIFs();
  76. Object oo = new Object();
  77. writeIFs1.tt_s = 1;
  78. writeIFs1.fireplaceControl(oo);
  79. assertEquals(213, writeIFs1.tt_s);
  80. }
  81. @Test
  82. public void TestFireControl2()
  83. {
  84. WriteIFs writeIFs1 = new WriteIFs();
  85. Object oo = new Object();
  86. writeIFs1.oo1 = 65;
  87. writeIFs1.tt_s = 1;
  88. writeIFs1.fireplaceControl(oo);
  89. assertEquals(213, writeIFs1.tt_s);
  90. }
  91. @Test
  92. public void TestFireControl3()
  93. {
  94. WriteIFs writeIFs1 = new WriteIFs();
  95. Object oo = new Object();
  96. writeIFs1.oo2 = 80;
  97. writeIFs1.tt_s = 1;
  98. writeIFs1.fireplaceControl(oo);
  99. assertEquals(213, writeIFs1.tt_s);
  100. }
  101. }