Wprowadzenie_do_testowania/Testy po pierwszej modyfikacji/GuessTheUnitsTest.java
2022-06-20 14:04:23 +02:00

81 lines
2.2 KiB
Java

package com.epam.bootcamp.bmi_calculator;
import static org.junit.Assert.*;
import org.junit.*;
public class GuessTheUnitsTest {
@Test
public void GuessTheUnitsTest1() throws Exception{
GuessTheUnits gtu = new GuessTheUnits(1.7,50.0);
assertEquals(gtu.getUnitType(),"metric");
}
@Test
public void GuessTheUnitsTest2() throws Exception{
GuessTheUnits gtu = new GuessTheUnits(170,50.0);
assertEquals(gtu.getUnitType(),"metric");
}
@Test
public void GuessTheUnitsTest3() throws Exception{
GuessTheUnits gtu = new GuessTheUnits(5.58,1764);
assertEquals(gtu.getUnitType(),"US");
assertEquals(gtu.getWeight(),110,1);
}
@Test
public void GuessTheUnitsTest4() throws Exception{
try{
GuessTheUnits gtu = new GuessTheUnits(170,1764);
assertEquals(gtu.getUnitType(),"US");
}catch(Exception e){
assertEquals(e.getMessage(),"Height and weight is in different metric.");
}
}
@Test
public void GuessTheUnitsTest5() throws Exception{
GuessTheUnits gtu = new GuessTheUnits(9.99,3.01);
assertEquals(gtu.getUnitType(),"US");
assertEquals(gtu.getWeight(),3.01,1);
}
@Test
public void GuessTheUnitsTest6() throws Exception{
GuessTheUnits gtu = new GuessTheUnits(9.99,2.99);
assertEquals(gtu.getUnitType(),"US");
assertEquals(gtu.getWeight(),3.01,1);
}
@Test
public void GuessTheUnitsTest7() throws Exception{
GuessTheUnits gtu = new GuessTheUnits(99,999);
assertEquals(gtu.getUnitType(),"US");
assertEquals(gtu.getWeight(),999.0,1);
}
@Test
public void GuessTheUnitsTest8() throws Exception{
GuessTheUnits gtu = new GuessTheUnits(101,20.0);
assertEquals(gtu.getUnitType(),"metric");
}
@Test
public void GuessTheUnitsTest9() throws Exception{
GuessTheUnits gtu = new GuessTheUnits(100,1000);
assertEquals(gtu.getUnitType(),"metric");
}
@Test
public void GuessTheUnitsTest10() throws Exception{
GuessTheUnits gtu = new GuessTheUnits(99,999);
assertEquals(gtu.getUnitType(),"US");
}
@Test
public void GuessTheUnitsTest11() throws Exception{
GuessTheUnits gtu = new GuessTheUnits(100,999);
assertEquals(gtu.getUnitType(),"metric");
}
@Test
public void GuessTheUnitsTest12() throws Exception{
GuessTheUnits gtu = new GuessTheUnits(99,1000);
assertEquals(gtu.getUnitType(),"US");
}
}