优化代码,调整变量、方法与类名,完善测试用例

This commit is contained in:
huangchengxing
2022-07-13 22:39:41 +08:00
parent b29b0c3932
commit a352783b5c
20 changed files with 625 additions and 482 deletions

View File

@@ -12,11 +12,11 @@ import java.util.HashMap;
import java.util.Map;
import java.util.function.UnaryOperator;
public class AliasAttributePostProcessorTest {
public class AliasAnnotationPostProcessorTest {
@Test
public void processTest() {
AliasAttributePostProcessor processor = new AliasAttributePostProcessor();
AliasAnnotationPostProcessor processor = new AliasAnnotationPostProcessor();
Map<Class<?>, SynthesizedAnnotation> annotationMap = new HashMap<>();
SynthesizedAnnotationAggregator synthesizedAnnotationAggregator = new TestSynthesizedAnnotationAggregator(annotationMap);

View File

@@ -12,11 +12,11 @@ import java.util.HashMap;
import java.util.Map;
import java.util.function.UnaryOperator;
public class AliasForLinkAttributePostProcessorTest {
public class AliasLinkAnnotationPostProcessorTest {
@Test
public void processForceAliasForTest() {
AliasForLinkAttributePostProcessor processor = new AliasForLinkAttributePostProcessor();
AliasLinkAnnotationPostProcessor processor = new AliasLinkAnnotationPostProcessor();
Map<Class<?>, SynthesizedAnnotation> annotationMap = new HashMap<>();
SynthesizedAnnotationAggregator synthesizedAnnotationAggregator = new TestSynthesizedAnnotationAggregator(annotationMap);
@@ -40,7 +40,7 @@ public class AliasForLinkAttributePostProcessorTest {
@Test
public void processAliasForTest() {
AliasForLinkAttributePostProcessor processor = new AliasForLinkAttributePostProcessor();
AliasLinkAnnotationPostProcessor processor = new AliasLinkAnnotationPostProcessor();
Map<Class<?>, SynthesizedAnnotation> annotationMap = new HashMap<>();
SynthesizedAnnotationAggregator synthesizedAnnotationAggregator = new TestSynthesizedAnnotationAggregator(annotationMap);

View File

@@ -12,11 +12,11 @@ import java.util.HashMap;
import java.util.Map;
import java.util.function.UnaryOperator;
public class MirrorLinkAttributePostProcessorTest {
public class MirrorLinkAnnotationPostProcessorTest {
@Test
public void processTest() {
MirrorLinkAttributePostProcessor processor = new MirrorLinkAttributePostProcessor();
MirrorLinkAnnotationPostProcessor processor = new MirrorLinkAnnotationPostProcessor();
Map<Class<?>, SynthesizedAnnotation> annotationMap = new HashMap<>();
SynthesizedAnnotationAggregator synthesizedAnnotationAggregator = new TestSynthesizedAnnotationAggregator(annotationMap);

View File

@@ -36,7 +36,7 @@ public class TypeAnnotationScannerTest {
annotations.forEach(a -> Assert.assertEquals(a.annotationType(), AnnotationForScannerTest.class));
// 不查找父类
scanner = new TypeAnnotationScanner().setIncludeSupperClass(false);
scanner = new TypeAnnotationScanner().setIncludeSuperClass(false);
annotations = scanner.getAnnotations(Example.class);
Assert.assertEquals(1, annotations.size());
annotations.forEach(a -> Assert.assertEquals(a.annotationType(), AnnotationForScannerTest.class));
@@ -88,7 +88,7 @@ public class TypeAnnotationScannerTest {
// 不查找父类
map.clear();
new TypeAnnotationScanner()
.setIncludeSupperClass(false)
.setIncludeSuperClass(false)
.scan(
(index, annotation) -> map.computeIfAbsent(index, i -> new ArrayList<>()).add(annotation),
Example.class, null