package models;
import org.junit.Test;
import util.InMemoryDbTest;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
public class ProductModelTest extends InMemoryDbTest {
@Test
public void testFindAllProducts(){
List<ProductModel> productModels = ProductModel.find.all();
assertNotNull("productModels null",productModels);
assertEquals("productModels count",4,productModels.size());
}
@Test
public void testFindById(){
ProductModel product = ProductModel.find.byId(3L);
assertNotNull("productModel null",product);
assertEquals("productModel name ", "Offshore by MET.no",product.name);
assertEquals("productModel price ",new Integer(250),product.price);
}
@Test
public void testFindByName(){
String productName = "Offshore by MET.no";
ProductModel product = ProductModel.findByName(productName);
assertNotNull("productModel null",product);
assertEquals("productModel name ",productName ,product.name);
}
}