Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.junit.jupiter.api.*;
- import static org.junit.jupiter.api.Assertions.*;
- public class unitCalcTest {
- private unitCalc uc;
- @BeforeAll
- static void init(){
- System.out.println("Tests have been initialized.");
- }
- @BeforeEach
- void beforeEach(){
- System.out.println("Next test...");
- }
- @Test
- @DisplayName("Check if mmhg -> hPa is correct")
- void test1(){
- uc = new unitCalc();
- assertEquals(10.6657912,uc.millOfMercToHecto(8),0.1);
- }
- @Test
- @DisplayName("Check if hPa -> mmHg is correct")
- void test2(){
- uc = new unitCalc();
- assertEquals(4.7503078065132,uc.hectoToMillOfMerc(5),0.1);
- }
- @Test
- @DisplayName("Check if 0 hPa -> mmHg 0")
- void test3(){
- uc = new unitCalc();
- assertEquals(0,uc.hectoToMillOfMerc(0),0.1);
- }
- @Test
- @DisplayName("Check if 0 mmHg -> hPa 0")
- void test4(){
- uc = new unitCalc();
- assertEquals(0,uc.millOfMercToHecto(0),0.1);
- }
- @Test
- @DisplayName("Check if negative mmhg -> hPa is correct")
- void test5(){
- uc = new unitCalc();
- assertEquals(-11.99915,uc.millOfMercToHecto(-9),0.1);
- }
- @Test
- @DisplayName("Check if negative hPa -> mmHg is correct")
- void test6(){
- uc = new unitCalc();
- assertEquals(-6.750554,uc.hectoToMillOfMerc(-9),0.1);
- }
- @Test
- @DisplayName("Is UC Null")
- void isUCNull(){
- uc = new unitCalc();
- assertNotNull(uc,()->"Object is not empty");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement