Skip to content

Commit

Permalink
Merge pull request #13 from mfeng-ya/fn_bug_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
abel533 authored May 20, 2024
2 parents 9dff28c + b4394ad commit 0da0d50
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/io/mybatis/mapper/fn/Fn.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,18 @@ public R apply(T t) {
return fn.apply(t);
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
FnImpl<?, ?> fnImpl = (FnImpl<?, ?>) o;
return Objects.equals(entityClass, fnImpl.entityClass) && Objects.equals(fn, fnImpl.fn);
}

@Override
public int hashCode() {
return Objects.hash(entityClass, fn);
}
}

/**
Expand Down
5 changes: 5 additions & 0 deletions src/test/java/io/mybatis/mapper/fn/FnTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ public void testMemoryOverflow() throws InterruptedException {
Assert.assertEquals(columnSize + 2, Fn.FN_COLUMN_MAP.size());
Assert.assertEquals(fieldSize + 2, Fn.FN_CLASS_FIELD_MAP.size());
}
for (int i = 0; i < 100; i++) {
Fn.of(User.class, User::getUserName);
Assert.assertEquals(columnSize + 3, Fn.FN_COLUMN_MAP.size());
Assert.assertEquals(fieldSize + 3, Fn.FN_CLASS_FIELD_MAP.size());
}
}

public static class BaseId {
Expand Down

0 comments on commit 0da0d50

Please sign in to comment.