Advertisement
Guest User

Untitled

a guest
Nov 17th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.59 KB | None | 0 0
  1.  
  2. import org.junit.jupiter.api.*;
  3.  
  4. import static org.junit.jupiter.api.Assertions.*;
  5.  
  6.  
  7. public class unitCalcTest {
  8.  
  9. private unitCalc uc;
  10.  
  11. @BeforeAll
  12. static void init(){
  13. System.out.println("Tests have been initialized.");
  14. }
  15.  
  16. @BeforeEach
  17. void beforeEach(){
  18. System.out.println("Next test...");
  19. }
  20.  
  21. @Test
  22. @DisplayName("Check if mmhg -> hPa is correct")
  23. void test1(){
  24. uc = new unitCalc();
  25. assertEquals(10.6657912,uc.millOfMercToHecto(8),0.1);
  26.  
  27. }
  28.  
  29. @Test
  30. @DisplayName("Check if hPa -> mmHg is correct")
  31. void test2(){
  32. uc = new unitCalc();
  33. assertEquals(4.7503078065132,uc.hectoToMillOfMerc(5),0.1);
  34. }
  35.  
  36. @Test
  37. @DisplayName("Check if 0 hPa -> mmHg 0")
  38. void test3(){
  39. uc = new unitCalc();
  40. assertEquals(0,uc.hectoToMillOfMerc(0),0.1);
  41. }
  42.  
  43. @Test
  44. @DisplayName("Check if 0 mmHg -> hPa 0")
  45. void test4(){
  46. uc = new unitCalc();
  47. assertEquals(0,uc.millOfMercToHecto(0),0.1);
  48. }
  49.  
  50. @Test
  51. @DisplayName("Check if negative mmhg -> hPa is correct")
  52. void test5(){
  53. uc = new unitCalc();
  54. assertEquals(-11.99915,uc.millOfMercToHecto(-9),0.1);
  55. }
  56.  
  57. @Test
  58. @DisplayName("Check if negative hPa -> mmHg is correct")
  59. void test6(){
  60. uc = new unitCalc();
  61. assertEquals(-6.750554,uc.hectoToMillOfMerc(-9),0.1);
  62. }
  63.  
  64. @Test
  65. @DisplayName("Is UC Null")
  66. void isUCNull(){
  67. uc = new unitCalc();
  68. assertNotNull(uc,()->"Object is not empty");
  69. }
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement