* BAEL-1277: RESTFul CRUD application with JavaLite.

* BAEL-1277: RESTFul CRUD application with JavaLite. Adding exception handling.

* BAEL-1277: Changes after editors review.
This commit is contained in:
Magdalena Krause
2018-01-08 18:34:16 -03:00
committed by maibin
parent 727554bf47
commit cbd1a9dfbf
5 changed files with 79 additions and 86 deletions

View File

@@ -8,18 +8,18 @@ public class ProductTest {
//@Test
public void givenSavedProduct_WhenFindFirst_ThenSavedProductIsReturned() {
//Open DB connection
Base.open("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/dbname", "user", "password");
//Open DB connection
Base.open("com.mysql.jdbc.Driver", "jdbc:mysql://localhost/dbname", "user", "password");
//Create a product and save it
Product toSaveProduct = new Product();
toSaveProduct.set("name", "Bread");
toSaveProduct.saveIt();
//Create a product and save it
Product toSaveProduct = new Product();
toSaveProduct.set("name", "Bread");
toSaveProduct.saveIt();
//Find product
Product savedProduct = Product.findFirst("name = ?", "Bread");
//Find product
Product savedProduct = Product.findFirst("name = ?", "Bread");
Assert.assertEquals(toSaveProduct.get("name"), savedProduct.get("name"));
Assert.assertEquals(toSaveProduct.get("name"), savedProduct.get("name"));
}
}