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.

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