use of com.litepaltest.model.Product in project LitePal by LitePalFramework.
the class SaveTest method testSaveFastWithConstructors.
public void testSaveFastWithConstructors() {
Computer computer = new Computer("asus", 699.00);
assertTrue(computer.saveFast());
Assert.assertTrue(isDataExists(getTableName(computer), computer.getId()));
Computer c = getComputer(computer.getId());
assertEquals("asus", c.getBrand());
assertEquals(699.00, c.getPrice());
Computer cc = DataSupport.find(Computer.class, computer.getId());
assertEquals("asus", cc.getBrand());
assertEquals(699.00, cc.getPrice());
Product p = new Product(null);
p.setBrand("apple");
p.setPrice(1222.33);
p.saveFast();
Product.find(Product.class, p.getId());
}
use of com.litepaltest.model.Product in project LitePal by LitePalFramework.
the class SaveTest method testSaveWithBlob.
public void testSaveWithBlob() {
byte[] b = new byte[10];
for (int i = 0; i < b.length; i++) {
b[i] = (byte) i;
}
Product product = new Product();
product.setBrand("Android");
product.setPrice(2899.69);
product.setPic(b);
assertTrue(product.saveFast());
Product p = DataSupport.find(Product.class, product.getId());
byte[] pic = p.getPic();
assertEquals(b.length, pic.length);
for (int i = 0; i < b.length; i++) {
assertEquals(i, pic[i]);
}
}
Aggregations