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 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 (your name)
  9. * @version (a version number or a date)
  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 TestCheckFuel()
  60. {
  61. WriteIFs writeIFs1 = new WriteIFs();
  62. writeIFs1.playerDied(true);
  63. assertEquals("Game Over!", writeIFs1.ss);
  64. }
  65. @Test
  66. public void TestFireControl()
  67. {
  68. WriteIFs writeIFs1 = new WriteIFs();
  69. writeIFs1.checkFuel(_0_5);
  70. assertEquals(0, writeIFs1.x);
  71. writeIFs1.checkFuel(_0_04);
  72. assertEquals(99, writeIFs1.x);
  73. }
  74. }