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
public Object onSet(Object entity, String property, Object 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
# username: root
# password: 12345678
mybatis-flex:
datasource:
ds1:
url: jdbc:mysql://127.0.0.1:3306/flex_test
username: root
password: 123456
ds2:
url: jdbc:mysql://127.0.0.1:3306/flex_test
username: root
password: 123456
#mybatis-flex:
# datasource:
# ds1:
# url: jdbc:mysql://127.0.0.1:3306/flex_test
# username: root
# password: 123456
# ds2:
# url: jdbc:mysql://127.0.0.1:3306/flex_test
# username: root
# password: 123456

View File

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