123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- /**
- * Created by leon on 1/10/18.
- */
-
- import org.junit.Assert;
- import org.junit.Test;
-
- public class ProductTest {
-
- @Test
- public void getPriceTest(){
- //Given
- Product test = new Product(5, "Melon", 10);
- //Then
- int expected = 5;
- int actual = test.getPrice();
- //Assert
- Assert.assertEquals(expected, actual);
-
- }
-
- @Test
- public void getIdTest(){
- //Given
- Product test = new Product(5, "Melon", 10);
- //Then
- String expected = "Melon";
- String actual = test.getId();
- //Assert
- Assert.assertEquals(expected, actual);
-
- }
-
- @Test
- public void getOnHandTest(){
- //Given
- Product test = new Product(5, "Melon", 10);
- //Then
- int expected = 10;
- int actual = test.getOnHand();
- //Assert
- Assert.assertEquals(expected, actual);
-
- }
-
- @Test
- public void changePriceTest(){
- //Given
- Product test = new Product(5, "Melon", 10);
- test.changePrice(3);
- //Then
- int expected = 3;
- int actual = test.getPrice();
- //Assert
- Assert.assertEquals(expected, actual);
-
- }
-
- @Test
- public void addOnHandTest(){
- //Given
- Product test = new Product(5, "Melon", 10);
- test.addOnHand(15);
- //Then
- int expected = 25;
- int actual = test.getOnHand();
- //Assert
- Assert.assertEquals(expected, actual);
-
- }
-
- @Test
- public void totalValueTest(){
- Product test = new Product(5, "Melon", 10);
- int expected = 50;
- int actual = test.totalValue();
-
- Assert.assertEquals(expected, actual);
- }
- }
|