Esempio n. 1
0
 @Test
 public void testPreUpdate() {
   spyStock.preUpdate();
   verify(spyStock, times(1)).preUpdate();
 }
Esempio n. 2
0
 @Test
 public void testStockIsNotDetached() {
   spyStock.setId(0L);
   assertFalse("Detached", spyStock.isDetached());
   verify(spyStock, times(1)).isDetached();
 }
Esempio n. 3
0
 @Test
 public void testPrePersist() {
   spyStock.prePersist();
   verify(spyStock, times(1)).prePersist();
 }
Esempio n. 4
0
 @Test
 public void testGetQuantity() {
   assertNull("Quantity", spyStock.getQuantity());
   verify(spyStock, times(1)).getQuantity();
 }
Esempio n. 5
0
 @Test
 public void testStockIsDetached() {
   spyStock.setId(1L);
   assertTrue("Detached", spyStock.isDetached());
   verify(spyStock, times(1)).isDetached();
 }
Esempio n. 6
0
 @Test
 public void testGetProduct() {
   assertNotNull("Product", spyStock.getProduct());
   verify(spyStock, times(1)).getProduct();
 }
Esempio n. 7
0
 @Before
 public void setUp() throws Exception {
   mockProduct = mock(Product.class);
   spyStock = spy(Stock.class);
   spyStock.setProduct(mockProduct);
 }
Esempio n. 8
0
 @Test
 public void testToString() {
   assertEquals(
       ToStringBuilder.reflectionToString(spyStock, SHORT_PREFIX_STYLE), spyStock.toString());
 }
Esempio n. 9
0
 @Test
 public void testSetQuantity() {
   spyStock.setQuantity(BigInteger.ZERO);
   assertEquals("Quantity", BigInteger.ZERO, spyStock.getQuantity());
   verify(spyStock, times(1)).setQuantity(any());
 }
Esempio n. 10
0
 @Test
 public void testSetProduct() {
   spyStock.setProduct(null);
   assertNull("Product", spyStock.getProduct());
   verify(spyStock, times(1)).setProduct(null);
 }