From a49440d1f791b88561cdc420acc085bbd63eb40f Mon Sep 17 00:00:00 2001 From: Soby Chacko Date: Wed, 8 Nov 2023 12:32:37 -0500 Subject: [PATCH] Test cleanup in schema registry modules - Remove the test name prefix from the test methods in the schema-registry releated modules Part of fixing https://github.com/spring-cloud/spring-cloud-stream/issues/2371. --- .../avro/AvroSchemaMessageConverterTests.java | 4 +- .../avro/AvroSchemaServiceManagerTests.java | 8 ++-- .../avro/SubjectNamingStrategyTest.java | 2 +- ...vroMessageConverterSerializationTests.java | 2 +- ...maRegistryClientMessageConverterTests.java | 8 ++-- .../AbstractServerControllerTest.java | 3 -- .../entityScanning/EntityScanningTests.java | 2 +- .../server/SchemaRegistryServerAvroTests.java | 40 +++++++++---------- 8 files changed, 33 insertions(+), 36 deletions(-) diff --git a/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/AvroSchemaMessageConverterTests.java b/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/AvroSchemaMessageConverterTests.java index 019e26aba..5547ff7a8 100644 --- a/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/AvroSchemaMessageConverterTests.java +++ b/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/AvroSchemaMessageConverterTests.java @@ -49,7 +49,7 @@ class AvroSchemaMessageConverterTests { static StubSchemaRegistryClient stubSchemaRegistryClient = new StubSchemaRegistryClient(); @Test - public void testSendMessageWithLocation() throws Exception { + public void sendMessageWithLocation() throws Exception { try (ConfigurableApplicationContext context = new SpringApplicationBuilder( TestChannelBinderConfiguration.getCompleteConfiguration(AvroSourceApplication.class)) @@ -96,7 +96,7 @@ class AvroSchemaMessageConverterTests { } @Test - public void testSendMessageWithoutLocation() throws Exception { + public void sendMessageWithoutLocation() throws Exception { try (ConfigurableApplicationContext context = new SpringApplicationBuilder( TestChannelBinderConfiguration.getCompleteConfiguration(AvroSourceApplication.class)) .web(WebApplicationType.NONE).run("--server.port=0", diff --git a/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/AvroSchemaServiceManagerTests.java b/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/AvroSchemaServiceManagerTests.java index 586abf1fd..3e20fdb6e 100644 --- a/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/AvroSchemaServiceManagerTests.java +++ b/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/AvroSchemaServiceManagerTests.java @@ -56,7 +56,7 @@ class AvroSchemaServiceManagerTests { private final Log logger = LogFactory.getLog(AvroSchemaServiceManagerTests.class); @Test - public void testWithDefaultImplementation() throws IOException { + public void withDefaultImplementation() throws IOException { assertThatThrownBy(() -> { AvroSchemaServiceManager defaultServiceManager = new AvroSchemaServiceManagerImpl(); @@ -91,7 +91,7 @@ class AvroSchemaServiceManagerTests { } @Test - public void testWithCustomImplementation() throws IOException { + public void withCustomImplementation() throws IOException { AvroSchemaServiceManager manager = new AvroSchemaServiceManager() { @Override public Schema getSchema(Class clazz) { @@ -152,7 +152,7 @@ class AvroSchemaServiceManagerTests { } @Test - public void testAvroSchemaMessageConverter() { + public void avroSchemaMessageConverter() { AvroSchemaMessageConverter converter = new AvroSchemaMessageConverter(); MimeType mimeType = new MimeType("application", "avro"); assertThat(mimeType).isEqualTo(converter.getSupportedMimeTypes().get(0)); @@ -177,7 +177,7 @@ class AvroSchemaServiceManagerTests { } @Test - public void testAvroSchemaMessageConverterException() { + public void avroSchemaMessageConverterException() { assertThatThrownBy(() -> { MimeType mimeType = new MimeType("application", "avro"); AvroSchemaServiceManager manager = new AvroSchemaServiceManagerImpl(); diff --git a/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/SubjectNamingStrategyTest.java b/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/SubjectNamingStrategyTest.java index 8c9f9e409..043ce9237 100644 --- a/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/SubjectNamingStrategyTest.java +++ b/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/avro/SubjectNamingStrategyTest.java @@ -50,7 +50,7 @@ class SubjectNamingStrategyTest { private static StubSchemaRegistryClient stubSchemaRegistryClient = new StubSchemaRegistryClient(); @Test - public void testQualifiedSubjectNamingStrategy() throws Exception { + public void qualifiedSubjectNamingStrategy() throws Exception { try (ConfigurableApplicationContext context = new SpringApplicationBuilder( TestChannelBinderConfiguration.getCompleteConfiguration(AvroSourceApplication.class)) .web(WebApplicationType.NONE).run("--server.port=0", diff --git a/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/serialization/AvroMessageConverterSerializationTests.java b/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/serialization/AvroMessageConverterSerializationTests.java index a8650aa29..bf494e956 100644 --- a/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/serialization/AvroMessageConverterSerializationTests.java +++ b/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/serialization/AvroMessageConverterSerializationTests.java @@ -126,7 +126,7 @@ class AvroMessageConverterSerializationTests { } @Test - public void testSchemaImport() throws Exception { + public void schemaImport() throws Exception { SchemaRegistryClient client = new DefaultSchemaRegistryClient(restTemplateBuilder); AvroSchemaServiceManager manager = new AvroSchemaServiceManagerImpl(); AvroSchemaRegistryClientMessageConverter converter = new AvroSchemaRegistryClientMessageConverter( diff --git a/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/serialization/AvroSchemaRegistryClientMessageConverterTests.java b/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/serialization/AvroSchemaRegistryClientMessageConverterTests.java index 72b8a2fcc..b6df22927 100644 --- a/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/serialization/AvroSchemaRegistryClientMessageConverterTests.java +++ b/schema-registry/spring-cloud-stream-schema-registry-client/src/test/java/org/springframework/cloud/stream/schema/serialization/AvroSchemaRegistryClientMessageConverterTests.java @@ -90,7 +90,7 @@ class AvroSchemaRegistryClientMessageConverterTests { } @Test - public void testSendMessage() throws Exception { + public void sendMessage() throws Exception { try (ConfigurableApplicationContext context = new SpringApplicationBuilder( TestChannelBinderConfiguration.getCompleteConfiguration(AvroSourceApplication.class)) .web(WebApplicationType.NONE).run("--server.port=0", @@ -118,7 +118,7 @@ class AvroSchemaRegistryClientMessageConverterTests { } @Test - public void testSchemaImportConfiguration() throws Exception { + public void schemaImportConfiguration() throws Exception { try (ConfigurableApplicationContext context = new SpringApplicationBuilder( TestChannelBinderConfiguration.getCompleteConfiguration(AvroSourceApplication.class)) @@ -146,7 +146,7 @@ class AvroSchemaRegistryClientMessageConverterTests { } @Test - public void testNoCacheConfiguration() { + public void noCacheConfiguration() { ConfigurableApplicationContext sourceContext = SpringApplication .run(NoCacheConfiguration.class, "--spring.main.web-environment=false"); AvroSchemaRegistryClientMessageConverter converter = sourceContext @@ -157,7 +157,7 @@ class AvroSchemaRegistryClientMessageConverterTests { } @Test - public void testNamedCacheIsRequested() { + public void namedCacheIsRequested() { CacheManager mockCache = Mockito.mock(CacheManager.class); when(mockCache.getCache(any())).thenReturn(new NoOpCache("")); AvroSchemaServiceManager manager = new AvroSchemaServiceManagerImpl(); diff --git a/schema-registry/spring-cloud-stream-schema-registry-core/src/test/java/org/springframework/cloud/stream/schema/registry/entityScanning/AbstractServerControllerTest.java b/schema-registry/spring-cloud-stream-schema-registry-core/src/test/java/org/springframework/cloud/stream/schema/registry/entityScanning/AbstractServerControllerTest.java index 4aafff1b1..29a98f692 100644 --- a/schema-registry/spring-cloud-stream-schema-registry-core/src/test/java/org/springframework/cloud/stream/schema/registry/entityScanning/AbstractServerControllerTest.java +++ b/schema-registry/spring-cloud-stream-schema-registry-core/src/test/java/org/springframework/cloud/stream/schema/registry/entityScanning/AbstractServerControllerTest.java @@ -29,9 +29,6 @@ import org.springframework.web.context.WebApplicationContext; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; - - - /** * @author Christian Tzolov */ diff --git a/schema-registry/spring-cloud-stream-schema-registry-core/src/test/java/org/springframework/cloud/stream/schema/registry/entityScanning/EntityScanningTests.java b/schema-registry/spring-cloud-stream-schema-registry-core/src/test/java/org/springframework/cloud/stream/schema/registry/entityScanning/EntityScanningTests.java index 6d13b27a7..46bf3d5a5 100644 --- a/schema-registry/spring-cloud-stream-schema-registry-core/src/test/java/org/springframework/cloud/stream/schema/registry/entityScanning/EntityScanningTests.java +++ b/schema-registry/spring-cloud-stream-schema-registry-core/src/test/java/org/springframework/cloud/stream/schema/registry/entityScanning/EntityScanningTests.java @@ -30,7 +30,7 @@ import org.springframework.context.ConfigurableApplicationContext; class EntityScanningTests { @Test - public void testApplicationWithEmbeddedSchemaRegistryServerOutsideOfRootPackage() + public void applicationWithEmbeddedSchemaRegistryServerOutsideOfRootPackage() throws Exception { final ConfigurableApplicationContext context = SpringApplication .run(CustomApplicationEmbeddingSchemaServer.class, "--server.port=0"); diff --git a/schema-registry/spring-cloud-stream-schema-registry-server/src/test/java/org/springframework/cloud/stream/schema/registry/server/SchemaRegistryServerAvroTests.java b/schema-registry/spring-cloud-stream-schema-registry-server/src/test/java/org/springframework/cloud/stream/schema/registry/server/SchemaRegistryServerAvroTests.java index 8bb26e368..5704c31ca 100644 --- a/schema-registry/spring-cloud-stream-schema-registry-server/src/test/java/org/springframework/cloud/stream/schema/registry/server/SchemaRegistryServerAvroTests.java +++ b/schema-registry/spring-cloud-stream-schema-registry-server/src/test/java/org/springframework/cloud/stream/schema/registry/server/SchemaRegistryServerAvroTests.java @@ -142,7 +142,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testUnsupportedFormat() { + public void unsupportedFormat() { Schema schema = toSchema("spring", "boot", null); try { this.client.postForEntity(this.serverControllerUri, schema, Schema.class); @@ -155,7 +155,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testInvalidSchema() { + public void invalidSchema() { Schema schema = toSchema("boot", AVRO_FORMAT_NAME, "{}"); try { this.client.postForEntity(this.serverControllerUri, schema, Schema.class); @@ -168,7 +168,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testInvalidSchemaGh22() { + public void invalidSchemaGh22() { Schema schema = toSchema("boot", AVRO_FORMAT_NAME, resourceToString("classpath:/invalid_schema.json")); try { @@ -183,7 +183,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testRegister1AvroSchema() { + public void register1AvroSchema() { Schema schema = toSchema("org.springframework.cloud.stream.schema.User", AVRO_FORMAT_NAME, resourceToString("classpath:/avro_user_definition_schema_v1.json")); registerSchemaAndAssertSuccess(schema, 1, 1); @@ -191,7 +191,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testFindByIdFound() { + public void findByIdFound() { ResponseEntity registerSchemaReponse = registerSchemaAndAssertSuccess( AVRO_USER_REGISTRY_SCHEMA_V1, 1, 1); @@ -210,7 +210,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testFindByIdNotFound() { + public void findByIdNotFound() { registerSchemaAndAssertSuccess(AVRO_USER_REGISTRY_SCHEMA_V1, 1, 1); @@ -226,12 +226,12 @@ class SchemaRegistryServerAvroTests { } @Test - public void testUserSchemaV2() { + public void userSchemaV2() { registerSchemasAndAssertSuccess(AVRO_USER_REGISTRY_SCHEMA_V1, AVRO_USER_REGISTRY_SCHEMA_V2); } @Test - public void testIdempotentRegistration() { + public void idempotentRegistration() { registerSchemaAndAssertSuccess(AVRO_USER_REGISTRY_SCHEMA_V1, 1, 1); @@ -245,7 +245,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testSchemaDeletionBySubjectFormatVersion() { + public void schemaDeletionBySubjectFormatVersion() { ResponseEntity registerSchemaAndAssertSuccess = registerSchemaAndAssertSuccess( AVRO_USER_REGISTRY_SCHEMA_V1, 1, 1); @@ -273,7 +273,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testSchemaDeletionBySubjectFormatVersionNotFound() { + public void schemaDeletionBySubjectFormatVersionNotFound() { ResponseEntity registerSchemaAndAssertSuccess = registerSchemaAndAssertSuccess( AVRO_USER_REGISTRY_SCHEMA_V1, 1, 1); @@ -295,7 +295,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testSchemaDeletionBySubjectFormatVersionNotAllowed() { + public void schemaDeletionBySubjectFormatVersionNotAllowed() { ResponseEntity registerSchemaAndAssertSuccess = registerSchemaAndAssertSuccess( AVRO_USER_REGISTRY_SCHEMA_V1, 1, 1); @@ -313,7 +313,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testSchemaDeletionById() { + public void schemaDeletionById() { ResponseEntity registerSchemaAndAssertSuccess = registerSchemaAndAssertSuccess( AVRO_USER_REGISTRY_SCHEMA_V1, 1, 1); @@ -334,7 +334,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testSchemaDeletionByIdNotFound() { + public void schemaDeletionByIdNotFound() { registerSchemaAndAssertSuccess(AVRO_USER_REGISTRY_SCHEMA_V1, 1, 1); @@ -352,7 +352,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testSchemaDeletionByIdNotAllowed() { + public void schemaDeletionByIdNotAllowed() { ResponseEntity registerSchemaAndAssertSuccess = registerSchemaAndAssertSuccess( AVRO_USER_REGISTRY_SCHEMA_V1, 1, 1); @@ -372,7 +372,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testSchemaDeletionBySubject() { + public void schemaDeletionBySubject() { Map>>> registerSchemaResponsesByFormatBySubject = registerSchemasAndAssertSuccess( AVRO_USER_REGISTRY_SCHEMA_V1, AVRO_USER_REGISTRY_SCHEMA_V2, AAVRO_USER_REGISTRY_SCHEMA_V1_WITH_QUAL_SUBJECT); @@ -409,7 +409,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testSchemaDeletionBySubjectNotFound() { + public void schemaDeletionBySubjectNotFound() { registerSchemaAndAssertSuccess(AVRO_USER_REGISTRY_SCHEMA_V1, 1, 1); @@ -423,7 +423,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testSchemaDeletionBySubjectNotAllowed() { + public void schemaDeletionBySubjectNotAllowed() { ResponseEntity registerSchemaAndAssertSuccess = registerSchemaAndAssertSuccess( AVRO_USER_REGISTRY_SCHEMA_V1, 1, 1); @@ -443,7 +443,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testFindSchemasBySubjectAndVersion() { + public void findSchemasBySubjectAndVersion() { Map>>> registerSchemaResponsesByFormatBySubject = registerSchemasAndAssertSuccess( AVRO_USER_REGISTRY_SCHEMA_V1, @@ -471,7 +471,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testFindBySubjectAndFormatOrderByVersionAscNoMatch() { + public void findBySubjectAndFormatOrderByVersionAscNoMatch() { String subject = "test"; String format = AVRO_FORMAT_NAME; @@ -484,7 +484,7 @@ class SchemaRegistryServerAvroTests { } @Test - public void testFindSchemasBySubjectAndFormat() { + public void findSchemasBySubjectAndFormat() { Map>>> registerSchemaResponsesByFormatBySubject = registerSchemasAndAssertSuccess( AVRO_USER_REGISTRY_SCHEMA_V1,