Skip to content

Commit e4c56ad

Browse files
committed
Ensure that accessor is used
1 parent daf08d7 commit e4c56ad

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/test/java/org/apache/ibatis/submitted/record_type/Property.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@
1616
package org.apache.ibatis.submitted.record_type;
1717

1818
public record Property(int id, String value, String URL) {
19+
public String value() {
20+
// Differentiate between method call and field access
21+
return value + "!";
22+
}
1923
}

src/test/java/org/apache/ibatis/submitted/record_type/RecordTypeTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ void testSelectRecord() {
4747
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
4848
RecordTypeMapper mapper = sqlSession.getMapper(RecordTypeMapper.class);
4949
Property prop = mapper.selectProperty(1);
50-
assertEquals("Val1", prop.value());
50+
assertEquals("Val1!", prop.value());
51+
assertEquals("https://www.google.com", prop.URL());
5152
}
5253
}
5354

@@ -56,7 +57,7 @@ void testSelectRecordAutomapping() {
5657
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
5758
RecordTypeMapper mapper = sqlSession.getMapper(RecordTypeMapper.class);
5859
Property prop = mapper.selectPropertyAutomapping(1);
59-
assertEquals("Val1", prop.value());
60+
assertEquals("Val1!", prop.value());
6061
assertEquals("https://www.google.com", prop.URL());
6162
}
6263
}
@@ -71,7 +72,7 @@ void testInsertRecord() {
7172
try (SqlSession sqlSession = sqlSessionFactory.openSession()) {
7273
RecordTypeMapper mapper = sqlSession.getMapper(RecordTypeMapper.class);
7374
Property prop = mapper.selectProperty(2);
74-
assertEquals("Val2", prop.value());
75+
assertEquals("Val2!!", prop.value());
7576
assertEquals("https://mybatis.org", prop.URL());
7677
}
7778
}

0 commit comments

Comments
 (0)