mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-12-07 09:39:01 +08:00
fix test
This commit is contained in:
parent
941c04d478
commit
1d43179470
@ -111,7 +111,8 @@ public class GenericAnnotationMapping implements AnnotationMapping<Annotation> {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取属性值
|
||||
* 获取指定属性的属性值<br>
|
||||
* 首先从属性方法中查找指定名称和属性类型一致的属性方法,然后调用属性方法获取返回值。
|
||||
*
|
||||
* @param attributeName 属性名称
|
||||
* @param attributeType 属性类型
|
||||
|
||||
@ -1327,26 +1327,17 @@ public class ArrayUtil extends PrimitiveArrayUtil {
|
||||
if (isArray(obj)) {
|
||||
try {
|
||||
final String className = obj.getClass().getComponentType().getName();
|
||||
switch (className) {
|
||||
case "long":
|
||||
return wrap((long[]) obj);
|
||||
case "int":
|
||||
return wrap((int[]) obj);
|
||||
case "short":
|
||||
return wrap((short[]) obj);
|
||||
case "char":
|
||||
return wrap((char[]) obj);
|
||||
case "byte":
|
||||
return wrap((byte[]) obj);
|
||||
case "boolean":
|
||||
return wrap((boolean[]) obj);
|
||||
case "float":
|
||||
return wrap((float[]) obj);
|
||||
case "double":
|
||||
return wrap((double[]) obj);
|
||||
default:
|
||||
return (Object[]) obj;
|
||||
}
|
||||
return switch (className) {
|
||||
case "long" -> wrap((long[]) obj);
|
||||
case "int" -> wrap((int[]) obj);
|
||||
case "short" -> wrap((short[]) obj);
|
||||
case "char" -> wrap((char[]) obj);
|
||||
case "byte" -> wrap((byte[]) obj);
|
||||
case "boolean" -> wrap((boolean[]) obj);
|
||||
case "float" -> wrap((float[]) obj);
|
||||
case "double" -> wrap((double[]) obj);
|
||||
default -> (Object[]) obj;
|
||||
};
|
||||
} catch (final Exception e) {
|
||||
throw ExceptionUtil.wrapRuntime(e);
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ package cn.hutool.v7.core.map.multi;
|
||||
|
||||
import cn.hutool.v7.core.collection.CollUtil;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Predicate;
|
||||
@ -30,6 +31,7 @@ import java.util.function.Predicate;
|
||||
* @since 6.0.0
|
||||
*/
|
||||
public class Graph<T> extends SetValueMap<T, T> {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
|
||||
@ -202,10 +202,14 @@ public class AnnotationUtilTest {
|
||||
|
||||
@Test
|
||||
public void testGetAnnotationAlias() {
|
||||
final MetaAnnotationForTest annotation = AnnotationUtil.getAnnotationAlias(AnnotationForTest.class, MetaAnnotationForTest.class);
|
||||
assertNotNull(annotation);
|
||||
assertEquals(annotation.value(), annotation.alias());
|
||||
assertEquals(MetaAnnotationForTest.class, annotation.annotationType());
|
||||
final MetaAnnotationForTest annotation = AnnotationUtil.getAnnotation(AnnotationForTest.class, MetaAnnotationForTest.class);
|
||||
Assertions.assertEquals("foo", annotation.value());
|
||||
final MetaAnnotationForTest annotationAlias = AnnotationUtil.getAnnotationAlias(AnnotationForTest.class, MetaAnnotationForTest.class);
|
||||
assertNotNull(annotationAlias);
|
||||
// value的别名是alias,因此获取value值时,实际返回的是alias的值
|
||||
assertEquals("", annotationAlias.value());
|
||||
assertEquals(annotationAlias.value(), annotationAlias.alias());
|
||||
assertEquals(MetaAnnotationForTest.class, annotationAlias.annotationType());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user