change name

This commit is contained in:
Looly
2024-01-02 23:15:29 +08:00
parent 9e426dd3a5
commit 028f498a04
13 changed files with 78 additions and 41 deletions

View File

@@ -12,6 +12,7 @@
package org.dromara.hutool.core.annotation;
import org.dromara.hutool.core.annotation.elements.CombinationAnnotatedElement;
import org.dromara.hutool.core.array.ArrayUtil;
import org.dromara.hutool.core.util.ObjUtil;
import lombok.SneakyThrows;
@@ -41,7 +42,7 @@ public class AnnotationUtilTest {
@Test
public void testToCombination() {
final CombinationAnnotationElement element = AnnotationUtil.toCombination(ClassForTest.class);
final CombinationAnnotatedElement element = AnnotationUtil.toCombination(ClassForTest.class);
Assertions.assertEquals(2, element.getAnnotations().length);
}

View File

@@ -12,25 +12,26 @@
package org.dromara.hutool.core.annotation;
import org.dromara.hutool.core.annotation.elements.CombinationAnnotatedElement;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.lang.annotation.*;
/**
* test for {@link CombinationAnnotationElement}
* test for {@link CombinationAnnotatedElement}
*/
public class CombinationAnnotationElementTest {
public class CombinationAnnotatedElementTest {
@Test
public void testOf() {
final CombinationAnnotationElement element = CombinationAnnotationElement.of(ClassForTest.class, a -> true);
final CombinationAnnotatedElement element = CombinationAnnotatedElement.of(ClassForTest.class, a -> true);
Assertions.assertNotNull(element);
}
@Test
public void testIsAnnotationPresent() {
final CombinationAnnotationElement element = CombinationAnnotationElement.of(ClassForTest.class, a -> true);
final CombinationAnnotatedElement element = CombinationAnnotatedElement.of(ClassForTest.class, a -> true);
Assertions.assertTrue(element.isAnnotationPresent(MetaAnnotationForTest.class));
}
@@ -38,21 +39,21 @@ public class CombinationAnnotationElementTest {
public void testGetAnnotation() {
final AnnotationForTest annotation1 = ClassForTest.class.getAnnotation(AnnotationForTest.class);
final MetaAnnotationForTest annotation2 = AnnotationForTest.class.getAnnotation(MetaAnnotationForTest.class);
final CombinationAnnotationElement element = CombinationAnnotationElement.of(ClassForTest.class, a -> true);
final CombinationAnnotatedElement element = CombinationAnnotatedElement.of(ClassForTest.class, a -> true);
Assertions.assertEquals(annotation1, element.getAnnotation(AnnotationForTest.class));
Assertions.assertEquals(annotation2, element.getAnnotation(MetaAnnotationForTest.class));
}
@Test
public void testGetAnnotations() {
final CombinationAnnotationElement element = CombinationAnnotationElement.of(ClassForTest.class, a -> true);
final CombinationAnnotatedElement element = CombinationAnnotatedElement.of(ClassForTest.class, a -> true);
final Annotation[] annotations = element.getAnnotations();
Assertions.assertEquals(2, annotations.length);
}
@Test
public void testGetDeclaredAnnotations() {
final CombinationAnnotationElement element = CombinationAnnotationElement.of(ClassForTest.class, a -> true);
final CombinationAnnotatedElement element = CombinationAnnotatedElement.of(ClassForTest.class, a -> true);
final Annotation[] annotations = element.getDeclaredAnnotations();
Assertions.assertEquals(2, annotations.length);
}

View File

@@ -13,6 +13,7 @@
package org.dromara.hutool.core.annotation;
import lombok.SneakyThrows;
import org.dromara.hutool.core.annotation.elements.HierarchicalAnnotatedElements;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

View File

@@ -12,6 +12,7 @@
package org.dromara.hutool.core.annotation;
import org.dromara.hutool.core.annotation.elements.MetaAnnotatedElement;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

View File

@@ -12,6 +12,7 @@
package org.dromara.hutool.core.annotation;
import org.dromara.hutool.core.annotation.elements.RepeatableMetaAnnotatedElement;
import org.dromara.hutool.core.collection.iter.IterUtil;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;