Skip to content

Add serializable to hashMap usage in tests #3346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,8 @@ void createCacheKeyWithAdditionalParameter() {
Object parameterObject = 1;

BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
private static final long serialVersionUID = 1L;

{
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
}
Expand Down Expand Up @@ -519,6 +521,8 @@ void createCacheKeyWithNull() {
Object parameterObject = null;

BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
private static final long serialVersionUID = 1L;

{
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
}
Expand Down Expand Up @@ -547,6 +551,8 @@ void createCacheKeyWithTypeHandler() {
Object parameterObject = 1;

BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
private static final long serialVersionUID = 1L;

{
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
}
Expand Down Expand Up @@ -575,6 +581,8 @@ void createCacheKeyWithMetaObject() {
Author parameterObject = new Author(-1, "cbegin", "******", "[email protected]", "N/A", Section.NEWS);

BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
private static final long serialVersionUID = 1L;

{
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
add(new ParameterMapping.Builder(config, "username", registry.getTypeHandler(String.class)).build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ void shouldGetWhichContainsDelim() {
void shouldGetWhichContainsIndex() {
richType.setRichList(Arrays.asList(1L, "abc"));
richType.setRichMap(new HashMap<String, Object>() {
private static final long serialVersionUID = 1L;

{
put("key1", "value1");
put("key2", "value2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ void shouldAddElement() {
@Override
void shouldAddAll() {
List<Object> list = new ArrayList<>() {
private static final long serialVersionUID = 1L;

{
add("1");
add("2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ void shouldSetWhichContainsDelim() {
wrapper.set(new PropertyTokenizer("author.id"), 1);

verify(map).put("author", new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("id", 1);
}
Expand All @@ -131,6 +133,8 @@ void shouldFindProperty() {
@Override
void shouldGetGetterNames() {
Set<String> sets = new HashSet<>() {
private static final long serialVersionUID = 1L;

{
add("key1");
add("key2");
Expand All @@ -148,6 +152,8 @@ void shouldGetGetterNames() {
@Override
void shouldGetSetterNames() {
Set<String> sets = new HashSet<>() {
private static final long serialVersionUID = 1L;

{
add("key1");
add("key2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ void parameterObjectGetPropertyValueWithAdditionalParameter() throws SQLExceptio
Object parameterObject = 1;

BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
private static final long serialVersionUID = 1L;

{
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
}
Expand Down Expand Up @@ -150,6 +152,8 @@ void parameterObjectGetPropertyValueWithNull() throws SQLException {
Object parameterObject = null;

BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
private static final long serialVersionUID = 1L;

{
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
}
Expand All @@ -176,6 +180,8 @@ void parameterObjectGetPropertyValueWithTypeHandler() throws SQLException {
Object parameterObject = 1;

BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
private static final long serialVersionUID = 1L;

{
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
}
Expand All @@ -202,6 +208,8 @@ void parameterObjectGetPropertyValueWithMetaObject() throws SQLException {
Author parameterObject = new Author(-1, "cbegin", "******", "[email protected]", "N/A", Section.NEWS);

BoundSql boundSql = new BoundSql(config, "some select statement", new ArrayList<ParameterMapping>() {
private static final long serialVersionUID = 1L;

{
add(new ParameterMapping.Builder(config, "id", registry.getTypeHandler(int.class)).build());
add(new ParameterMapping.Builder(config, "username", registry.getTypeHandler(String.class)).build());
Expand Down Expand Up @@ -250,6 +258,8 @@ void parameterObjectGetPropertyValueWithMetaObjectAndCreateOnce() {
new StaticSqlSource(mockConfig, "some select statement"), SqlCommandType.SELECT).build();

BoundSql boundSql = new BoundSql(mockConfig, "some select statement", new ArrayList<ParameterMapping>() {
private static final long serialVersionUID = 1L;

{
add(new ParameterMapping.Builder(mockConfig, "id", registry.getTypeHandler(int.class))
.jdbcType(JdbcType.INTEGER).build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ void setup() {
@Override
public void shouldApply() throws Exception {
when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("title", "abc");
put("author", new Author(1, "mybatis", "***", null, null, null));
Expand All @@ -87,6 +89,8 @@ public void shouldApply() throws Exception {
@Test
void shouldAppendSecond() throws Exception {
when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("author", new Author(1, "mybatis", "***", null, null, null));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public void shouldApply() throws Exception {
doNothing().when(context).bind(bindKeyCaptor.capture(), bindValueCaptor.capture());

when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("list", Arrays.asList("a", "b", "c"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ void setup() {
@Override
public void shouldApply() throws Exception {
when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("title", "ENGLISH");
}
Expand All @@ -68,6 +70,8 @@ public void shouldApply() throws Exception {
@Test
void shouldAppendNone() {
when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("title", null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ void setup() {
@Override
public void shouldApply() throws Exception {
when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("username", "Jack");
put("password", "***");
Expand All @@ -78,6 +80,8 @@ public void shouldApply() throws Exception {
@Test
void shouldAppendOnlyUsername() throws Exception {
when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("username", "Jack");
}
Expand All @@ -92,6 +96,8 @@ void shouldAppendOnlyUsername() throws Exception {
@Test
void shouldAppendOnlyPassword() throws Exception {
when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("password", "***");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ void shouldApplyDynamic() {
// given
TextSqlNode sqlNode = new TextSqlNode(DYNAMIC_TEXT);
when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("id", 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ void setup() {
@Override
public void shouldApply() throws Exception {
when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("id", 1);
put("name", "mybatis");
Expand All @@ -80,6 +82,8 @@ public void shouldApply() throws Exception {
@Test
void shouldAppendOnlyId() throws Exception {
when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("id", 1);
}
Expand All @@ -94,6 +98,8 @@ void shouldAppendOnlyId() throws Exception {
@Test
void shouldAppendOnlyName() throws Exception {
when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("name", "mybatis");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ void setup() {
@Override
public void shouldApply() throws Exception {
when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("_parameter", new Bean("abc"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ void setup() {
@Override
public void shouldApply() throws Exception {
when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("id", 1);
put("name", "mybatis");
Expand All @@ -78,6 +80,8 @@ public void shouldApply() throws Exception {
@Test
void shouldAppendOnlyId() throws Exception {
when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("id", 1);
}
Expand All @@ -92,6 +96,8 @@ void shouldAppendOnlyId() throws Exception {
@Test
void shouldAppendOnlyName() throws Exception {
when(context.getBindings()).thenReturn(new HashMap<>() {
private static final long serialVersionUID = 1L;

{
put("name", "mybatis");
}
Expand Down
Loading