Aias00 commented on code in PR #7322:
URL: https://github.com/apache/shenyu/pull/7322#discussion_r4114109494
##########
shenyu-common/src/test/java/org/apache/shenyu/common/dto/convert/selector/ZombieUpstreamTest.java:
##########
@@ -65,8 +69,21 @@ public void testEqualsAndHashCode() {
@Test
public void testTransform() {
ZombieUpstream upstream = ZombieUpstream.transform(new
CommonUpstream(), 10, "id");
-
+
assertThat(upstream, is(notNullValue()));
}
+ @Test
+ public void testSelectorIdFollowsJavaBeanContract() throws Exception {
Review Comment:
Two small suggestions here:
1. Prefer imports over fully-qualified names inside the method body
(`java.beans.BeanInfo`, `PropertyDescriptor`), matching the style of the rest
of the test suite.
2. `Introspector` results are cached JVM-wide per class by the JDK, and
`Introspector.flushCaches()` is not called here — that is fine, but if a future
test exercises `Introspector` on another type concurrently this relies on
JUnit's default sequential execution. Worth a short comment if you keep this
pattern.
Also consider asserting `selectorId.getReadMethod()` is non-null as well, so
the pair is verified rather than only half of it. The second assertion already
covers the phantom-property half nicely.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]