示例#1
0
 @Transactional(propagation = Propagation.REQUIRES_NEW)
 @JpaUnit("unit2")
 protected void access_to_unit2_with_new_transaction() {
   Item2 item2 = new Item2();
   item2.setID(30L);
   item2.setName("item2Name");
   item2Repository.save(item2);
   Assertions.assertThat(item2.getID()).isEqualTo(30L);
 }
示例#2
0
 @Test(expected = IllegalArgumentException.class)
 @Transactional
 @JpaUnit("unit1")
 public void access_to_unit2_with_unit1_transaction_should_fail() throws Exception {
   Item2 item2 = new Item2();
   item2.setID(10L);
   item2.setName("item2Name");
   item2Repository.save(item2);
   fail("should have failed");
 }