From 77129f5a2b3b85262a006dc6edfe962550cfa8b4 Mon Sep 17 00:00:00 2001 From: Stephane Nicoll Date: Sat, 5 Jan 2019 09:57:37 +0100 Subject: [PATCH] Polish --- .../CandidateComponentsIndexerTests.java | 57 +++++++++---------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/spring-context-indexer/src/test/java/org/springframework/context/index/processor/CandidateComponentsIndexerTests.java b/spring-context-indexer/src/test/java/org/springframework/context/index/processor/CandidateComponentsIndexerTests.java index 2d45a60710f..c31486b3a99 100644 --- a/spring-context-indexer/src/test/java/org/springframework/context/index/processor/CandidateComponentsIndexerTests.java +++ b/spring-context-indexer/src/test/java/org/springframework/context/index/processor/CandidateComponentsIndexerTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,87 +84,86 @@ public class CandidateComponentsIndexerTests { this.compiler = new TestCompiler(this.temporaryFolder); } - @Test - public void noCandidate() throws IOException { + public void noCandidate() { CandidateComponentsMetadata metadata = compile(SampleNone.class); assertThat(metadata.getItems(), hasSize(0)); } @Test - public void noAnnotation() throws IOException { + public void noAnnotation() { CandidateComponentsMetadata metadata = compile(CandidateComponentsIndexerTests.class); assertThat(metadata.getItems(), hasSize(0)); } @Test - public void stereotypeComponent() throws IOException { + public void stereotypeComponent() { testComponent(SampleComponent.class); } @Test - public void stereotypeService() throws IOException { + public void stereotypeService() { testComponent(SampleService.class); } @Test - public void stereotypeController() throws IOException { + public void stereotypeController() { testComponent(SampleController.class); } @Test - public void stereotypeControllerMetaAnnotation() throws IOException { + public void stereotypeControllerMetaAnnotation() { testComponent(SampleMetaController.class); } @Test - public void stereotypeRepository() throws IOException { + public void stereotypeRepository() { testSingleComponent(SampleRepository.class, Component.class); } @Test - public void stereotypeControllerMetaIndex() throws IOException { + public void stereotypeControllerMetaIndex() { testSingleComponent(SampleMetaIndexedController.class, Component.class, MetaControllerIndexed.class); } @Test - public void stereotypeOnAbstractClass() throws IOException { + public void stereotypeOnAbstractClass() { testComponent(AbstractController.class); } @Test - public void cdiManagedBean() throws IOException { + public void cdiManagedBean() { testSingleComponent(SampleManagedBean.class, ManagedBean.class); } @Test - public void cdiNamed() throws IOException { + public void cdiNamed() { testSingleComponent(SampleNamed.class, Named.class); } @Test - public void persistenceEntity() throws IOException { + public void persistenceEntity() { testSingleComponent(SampleEntity.class, Entity.class); } @Test - public void persistenceMappedSuperClass() throws IOException { + public void persistenceMappedSuperClass() { testSingleComponent(SampleMappedSuperClass.class, MappedSuperclass.class); } @Test - public void persistenceEmbeddable() throws IOException { + public void persistenceEmbeddable() { testSingleComponent(SampleEmbeddable.class, Embeddable.class); } @Test - public void persistenceConverter() throws IOException { + public void persistenceConverter() { testSingleComponent(SampleConverter.class, Converter.class); } @Test - public void packageInfo() throws IOException { + public void packageInfo() { CandidateComponentsMetadata metadata = compile( "org/springframework/context/index/sample/jpa/package-info"); assertThat(metadata, hasComponent( @@ -172,32 +171,32 @@ public class CandidateComponentsIndexerTests { } @Test - public void typeStereotypeFromMetaInterface() throws IOException { + public void typeStereotypeFromMetaInterface() { testSingleComponent(SampleSpecializedRepo.class, Repo.class); } @Test - public void typeStereotypeFromInterfaceFromSuperClass() throws IOException { + public void typeStereotypeFromInterfaceFromSuperClass() { testSingleComponent(SampleRepo.class, Repo.class); } @Test - public void typeStereotypeFromSeveralInterfaces() throws IOException { + public void typeStereotypeFromSeveralInterfaces() { testSingleComponent(SampleSmartRepo.class, Repo.class, SmartRepo.class); } @Test - public void typeStereotypeOnInterface() throws IOException { + public void typeStereotypeOnInterface() { testSingleComponent(SpecializedRepo.class, Repo.class); } @Test - public void typeStereotypeOnInterfaceFromSeveralInterfaces() throws IOException { + public void typeStereotypeOnInterfaceFromSeveralInterfaces() { testSingleComponent(SmartRepo.class, Repo.class, SmartRepo.class); } @Test - public void typeStereotypeOnIndexedInterface() throws IOException { + public void typeStereotypeOnIndexedInterface() { testSingleComponent(Repo.class, Repo.class); } @@ -217,12 +216,12 @@ public class CandidateComponentsIndexerTests { } @Test - public void embeddedNonStaticCandidateAreIgnored() throws IOException { + public void embeddedNonStaticCandidateAreIgnored() { CandidateComponentsMetadata metadata = compile(SampleNonStaticEmbedded.class); assertThat(metadata.getItems(), hasSize(0)); } - private void testComponent(Class... classes) throws IOException { + private void testComponent(Class... classes) { CandidateComponentsMetadata metadata = compile(classes); for (Class c : classes) { assertThat(metadata, hasComponent(c, Component.class)); @@ -230,19 +229,19 @@ public class CandidateComponentsIndexerTests { assertThat(metadata.getItems(), hasSize(classes.length)); } - private void testSingleComponent(Class target, Class... stereotypes) throws IOException { + private void testSingleComponent(Class target, Class... stereotypes) { CandidateComponentsMetadata metadata = compile(target); assertThat(metadata, hasComponent(target, stereotypes)); assertThat(metadata.getItems(), hasSize(1)); } - private CandidateComponentsMetadata compile(Class... types) throws IOException { + private CandidateComponentsMetadata compile(Class... types) { CandidateComponentsIndexer processor = new CandidateComponentsIndexer(); this.compiler.getTask(types).call(processor); return readGeneratedMetadata(this.compiler.getOutputLocation()); } - private CandidateComponentsMetadata compile(String... types) throws IOException { + private CandidateComponentsMetadata compile(String... types) { CandidateComponentsIndexer processor = new CandidateComponentsIndexer(); this.compiler.getTask(types).call(processor); return readGeneratedMetadata(this.compiler.getOutputLocation());