mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-12-07 17:48:40 +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 attributeName 属性名称
|
||||||
* @param attributeType 属性类型
|
* @param attributeType 属性类型
|
||||||
|
|||||||
@ -1327,26 +1327,17 @@ public class ArrayUtil extends PrimitiveArrayUtil {
|
|||||||
if (isArray(obj)) {
|
if (isArray(obj)) {
|
||||||
try {
|
try {
|
||||||
final String className = obj.getClass().getComponentType().getName();
|
final String className = obj.getClass().getComponentType().getName();
|
||||||
switch (className) {
|
return switch (className) {
|
||||||
case "long":
|
case "long" -> wrap((long[]) obj);
|
||||||
return wrap((long[]) obj);
|
case "int" -> wrap((int[]) obj);
|
||||||
case "int":
|
case "short" -> wrap((short[]) obj);
|
||||||
return wrap((int[]) obj);
|
case "char" -> wrap((char[]) obj);
|
||||||
case "short":
|
case "byte" -> wrap((byte[]) obj);
|
||||||
return wrap((short[]) obj);
|
case "boolean" -> wrap((boolean[]) obj);
|
||||||
case "char":
|
case "float" -> wrap((float[]) obj);
|
||||||
return wrap((char[]) obj);
|
case "double" -> wrap((double[]) obj);
|
||||||
case "byte":
|
default -> (Object[]) obj;
|
||||||
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;
|
|
||||||
}
|
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
throw ExceptionUtil.wrapRuntime(e);
|
throw ExceptionUtil.wrapRuntime(e);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ package cn.hutool.v7.core.map.multi;
|
|||||||
|
|
||||||
import cn.hutool.v7.core.collection.CollUtil;
|
import cn.hutool.v7.core.collection.CollUtil;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
@ -30,6 +31,7 @@ import java.util.function.Predicate;
|
|||||||
* @since 6.0.0
|
* @since 6.0.0
|
||||||
*/
|
*/
|
||||||
public class Graph<T> extends SetValueMap<T, T> {
|
public class Graph<T> extends SetValueMap<T, T> {
|
||||||
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -202,10 +202,14 @@ public class AnnotationUtilTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetAnnotationAlias() {
|
public void testGetAnnotationAlias() {
|
||||||
final MetaAnnotationForTest annotation = AnnotationUtil.getAnnotationAlias(AnnotationForTest.class, MetaAnnotationForTest.class);
|
final MetaAnnotationForTest annotation = AnnotationUtil.getAnnotation(AnnotationForTest.class, MetaAnnotationForTest.class);
|
||||||
assertNotNull(annotation);
|
Assertions.assertEquals("foo", annotation.value());
|
||||||
assertEquals(annotation.value(), annotation.alias());
|
final MetaAnnotationForTest annotationAlias = AnnotationUtil.getAnnotationAlias(AnnotationForTest.class, MetaAnnotationForTest.class);
|
||||||
assertEquals(MetaAnnotationForTest.class, annotation.annotationType());
|
assertNotNull(annotationAlias);
|
||||||
|
// value的别名是alias,因此获取value值时,实际返回的是alias的值
|
||||||
|
assertEquals("", annotationAlias.value());
|
||||||
|
assertEquals(annotationAlias.value(), annotationAlias.alias());
|
||||||
|
assertEquals(MetaAnnotationForTest.class, annotationAlias.annotationType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user