@Test public void isIdSetReturnsTrue() { TdProductShipment model = new TdProductShipment(); model.setProductShipmentId(ValueGenerator.getUniqueInteger()); assertNotNull(model.getProductShipmentId()); assertTrue(model.isIdSet()); }
@Test public void equalsUsingPk() { TdProductShipment model1 = new TdProductShipment(); TdProductShipment model2 = new TdProductShipment(); Integer productShipmentId = ValueGenerator.getUniqueInteger(); model1.setProductShipmentId(productShipmentId); model2.setProductShipmentId(productShipmentId); model1.setShipmentMrpCost(1f); model2.setShipmentMrpCost(1f); model1.setShipmentDiscount(1f); model2.setShipmentDiscount(1f); model1.setShipmentPolicy("a"); model2.setShipmentPolicy("a"); model1.setShipmentSpecialNote("a"); model2.setShipmentSpecialNote("a"); model1.setShipmentDuration(1); model2.setShipmentDuration(1); model1.setShipmentType(1); model2.setShipmentType(1); model1.setShipmentStatus(true); model2.setShipmentStatus(true); model1.setCustom1("a"); model2.setCustom1("a"); model1.setCustom2("a"); model2.setCustom2("a"); model1.setCreationDate(new Date()); model2.setCreationDate(new Date()); model1.setUpdationDate(new Date()); model2.setUpdationDate(new Date()); assertTrue(model1.isIdSet()); assertTrue(model2.isIdSet()); assertTrue(model1.hashCode() == model2.hashCode()); assertTrue(model1.equals(model2)); assertTrue(model2.equals(model1)); }
@Test public void manyToOne_setShipmentVendor() { TdProductShipment many = new TdProductShipment(); // init TdShipmentVendor one = new TdShipmentVendor(); one.setShipmentVendorId(ValueGenerator.getUniqueInteger()); many.setShipmentVendor(one); // make sure it is propagated properly assertNotNull(many.getShipmentVendorId()); assertEquals(one, many.getShipmentVendor()); assertSame(many.getShipmentVendorId(), one.getShipmentVendorId()); // now set it to back to null many.setShipmentVendor(null); // make sure null is propagated properly assertNull(many.getShipmentVendor()); // make sure it is propagated on fk column as well assertNull(many.getShipmentVendorId()); }