test: 测试回调方法。

This commit is contained in:
Suomm 2023-08-22 15:10:30 +08:00
parent a858e498d3
commit c22d382c27
3 changed files with 23 additions and 11 deletions

View File

@ -27,7 +27,7 @@ public class GoodOnSetListener implements SetListener {
@Override @Override
public Object onSet(Object entity, String property, Object value) { public Object onSet(Object entity, String property, Object value) {
System.out.println("Good: " + property + " --- " + value); System.out.println("Good: " + property + " --- " + value);
return null; return value;
} }
} }

View File

@ -36,13 +36,13 @@ spring:
# url: jdbc:mysql://localhost:3306/flex_test # url: jdbc:mysql://localhost:3306/flex_test
# username: root # username: root
# password: 12345678 # password: 12345678
mybatis-flex: #mybatis-flex:
datasource: # datasource:
ds1: # ds1:
url: jdbc:mysql://127.0.0.1:3306/flex_test # url: jdbc:mysql://127.0.0.1:3306/flex_test
username: root # username: root
password: 123456 # password: 123456
ds2: # ds2:
url: jdbc:mysql://127.0.0.1:3306/flex_test # url: jdbc:mysql://127.0.0.1:3306/flex_test
username: root # username: root
password: 123456 # password: 123456

View File

@ -57,6 +57,18 @@ class ActiveRecordTest {
Assertions.assertTrue(saved); Assertions.assertTrue(saved);
} }
@Test
void testInsertCallback() {
Integer goodId = Good.create()
.setPrice(28.0)
.setName("摆渡人")
.saveCallback()
.orElseThrow(RuntimeException::new)
.getGoodId();
System.out.println(goodId);
}
@Test @Test
void testUpdate() { void testUpdate() {
Good.create() Good.create()