diff --git a/hutool-core/src/test/java/org/dromara/hutool/core/bean/IssueIAYGT0Test.java b/hutool-core/src/test/java/org/dromara/hutool/core/bean/IssueIAYGT0Test.java new file mode 100644 index 000000000..e9f0d9bcd --- /dev/null +++ b/hutool-core/src/test/java/org/dromara/hutool/core/bean/IssueIAYGT0Test.java @@ -0,0 +1,26 @@ +package org.dromara.hutool.core.bean; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +public class IssueIAYGT0Test { + @Test + void setPropertyTest() { + final Cat cat = new Cat(); + // 优先调用setter方法 + BeanUtil.setProperty(cat, "name", "Kitty"); + Assertions.assertEquals("RedKitty", cat.getName()); + } + + static class Cat { + private String name; + + public void setName(final String name) { + this.name = "Red" + name; + } + + public String getName() { + return name; + } + } +}