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.

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