128 lines
3.6 KiB
Java
128 lines
3.6 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 GuessTheUnitsTest13() throws Exception{
|
|
GuessTheUnits gtu = new GuessTheUnits(10,3.01);
|
|
assertEquals(gtu.getUnitType(),"US");
|
|
assertEquals(gtu.getWeight(),3.01,1);
|
|
}
|
|
@Test
|
|
public void GuessTheUnitsTest14() throws Exception{
|
|
GuessTheUnits gtu = new GuessTheUnits(10.01,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");
|
|
}
|
|
@Test
|
|
public void GuessTheUnitsTest15() throws Exception{
|
|
GuessTheUnits gtu = new GuessTheUnits(10,1000);
|
|
assertEquals(gtu.getUnitType(),"US");
|
|
}
|
|
@Test
|
|
public void GuessTheUnitsTest16() throws Exception{
|
|
GuessTheUnits gtu = new GuessTheUnits(9,1000);
|
|
assertEquals(gtu.getUnitType(),"US");
|
|
}
|
|
@Test
|
|
public void GuessTheUnitsTest17() throws Exception{
|
|
GuessTheUnits gtu = new GuessTheUnits(9,1001);
|
|
assertEquals(gtu.getUnitType(),"US");
|
|
}
|
|
@Test
|
|
public void GuessTheUnitsTest18() throws Exception{
|
|
GuessTheUnits gtu = new GuessTheUnits(9,999);
|
|
assertEquals(gtu.getUnitType(),"US");
|
|
}
|
|
@Test
|
|
public void GuessTheUnitsTest19() throws Exception{
|
|
GuessTheUnits gtu = new GuessTheUnits(3,1000);
|
|
assertEquals(gtu.getUnitType(),"metric");
|
|
}
|
|
@Test
|
|
public void GuessTheUnitsTest20() throws Exception{
|
|
GuessTheUnits gtu = new GuessTheUnits(3.,600);
|
|
assertEquals(gtu.getUnitType(),"metric");
|
|
}
|
|
@Test
|
|
public void GuessTheUnitsTest21() throws Exception{
|
|
GuessTheUnits gtu = new GuessTheUnits(3,1000);
|
|
assertEquals(gtu.getUnitType(),"metric");
|
|
}
|
|
}
|