Polish
This commit is contained in:
@@ -32,31 +32,28 @@ public class OverrideAutoConfigurationContextCustomizerFactoryTests {
|
||||
private OverrideAutoConfigurationContextCustomizerFactory factory = new OverrideAutoConfigurationContextCustomizerFactory();
|
||||
|
||||
@Test
|
||||
public void getContextCustomizerWhenHasNoAnnotationShouldReturnNull()
|
||||
throws Exception {
|
||||
public void getContextCustomizerWhenHasNoAnnotationShouldReturnNull() {
|
||||
ContextCustomizer customizer = this.factory
|
||||
.createContextCustomizer(NoAnnotation.class, null);
|
||||
assertThat(customizer).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getContextCustomizerWhenHasAnnotationEnabledTrueShouldReturnNull()
|
||||
throws Exception {
|
||||
public void getContextCustomizerWhenHasAnnotationEnabledTrueShouldReturnNull() {
|
||||
ContextCustomizer customizer = this.factory
|
||||
.createContextCustomizer(WithAnnotationEnabledTrue.class, null);
|
||||
assertThat(customizer).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getContextCustomizerWhenHasAnnotationEnabledFalseShouldReturnCustomizer()
|
||||
throws Exception {
|
||||
public void getContextCustomizerWhenHasAnnotationEnabledFalseShouldReturnCustomizer() {
|
||||
ContextCustomizer customizer = this.factory
|
||||
.createContextCustomizer(WithAnnotationEnabledFalse.class, null);
|
||||
assertThat(customizer).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hashCodeAndEquals() throws Exception {
|
||||
public void hashCodeAndEquals() {
|
||||
ContextCustomizer customizer1 = this.factory
|
||||
.createContextCustomizer(WithAnnotationEnabledFalse.class, null);
|
||||
ContextCustomizer customizer2 = this.factory
|
||||
|
||||
@@ -51,7 +51,7 @@ public class SpringBootDependencyInjectionTestExecutionListenerPostConstructInte
|
||||
}
|
||||
|
||||
@Test
|
||||
public void postConstructShouldBeInvokedOnlyOnce() throws Exception {
|
||||
public void postConstructShouldBeInvokedOnlyOnce() {
|
||||
// gh-6874
|
||||
assertThat(this.calls).hasSize(1);
|
||||
}
|
||||
|
||||
@@ -53,8 +53,7 @@ public class SpringBootDependencyInjectionTestExecutionListenerTests {
|
||||
private SpringBootDependencyInjectionTestExecutionListener reportListener = new SpringBootDependencyInjectionTestExecutionListener();
|
||||
|
||||
@Test
|
||||
public void orderShouldBeSameAsDependencyInjectionTestExecutionListener()
|
||||
throws Exception {
|
||||
public void orderShouldBeSameAsDependencyInjectionTestExecutionListener() {
|
||||
Ordered injectionListener = new DependencyInjectionTestExecutionListener();
|
||||
assertThat(this.reportListener.getOrder())
|
||||
.isEqualTo(injectionListener.getOrder());
|
||||
|
||||
@@ -44,7 +44,7 @@ public class AutoConfigureCacheIntegrationTests {
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Test
|
||||
public void shouldConfigureNoOpCacheManager() throws Exception {
|
||||
public void shouldConfigureNoOpCacheManager() {
|
||||
CacheManager bean = this.applicationContext.getBean(CacheManager.class);
|
||||
assertThat(bean).isInstanceOf(NoOpCacheManager.class);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class FilterAnnotationsTests {
|
||||
|
||||
@Override
|
||||
public boolean match(MetadataReader metadataReader,
|
||||
MetadataReaderFactory metadataReaderFactory) throws IOException {
|
||||
MetadataReaderFactory metadataReaderFactory) {
|
||||
return metadataReader.getClassMetadata().getClassName()
|
||||
.equals(ExampleWithoutAnnotation.class.getName());
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.boot.test.autoconfigure.filter;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.boot.context.TypeExcludeFilter;
|
||||
@@ -47,23 +45,21 @@ public class TypeExcludeFiltersContextCustomizerFactoryTests {
|
||||
private ConfigurableApplicationContext context = new AnnotationConfigApplicationContext();
|
||||
|
||||
@Test
|
||||
public void getContextCustomizerWhenHasNoAnnotationShouldReturnNull()
|
||||
throws Exception {
|
||||
public void getContextCustomizerWhenHasNoAnnotationShouldReturnNull() {
|
||||
ContextCustomizer customizer = this.factory
|
||||
.createContextCustomizer(NoAnnotation.class, null);
|
||||
assertThat(customizer).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getContextCustomizerWhenHasAnnotationShouldReturnCustomizer()
|
||||
throws Exception {
|
||||
public void getContextCustomizerWhenHasAnnotationShouldReturnCustomizer() {
|
||||
ContextCustomizer customizer = this.factory
|
||||
.createContextCustomizer(WithExcludeFilters.class, null);
|
||||
assertThat(customizer).isNotNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hashCodeAndEquals() throws Exception {
|
||||
public void hashCodeAndEquals() {
|
||||
ContextCustomizer customizer1 = this.factory
|
||||
.createContextCustomizer(WithExcludeFilters.class, null);
|
||||
ContextCustomizer customizer2 = this.factory
|
||||
@@ -117,7 +113,7 @@ public class TypeExcludeFiltersContextCustomizerFactoryTests {
|
||||
|
||||
@Override
|
||||
public boolean match(MetadataReader metadataReader,
|
||||
MetadataReaderFactory metadataReaderFactory) throws IOException {
|
||||
MetadataReaderFactory metadataReaderFactory) {
|
||||
return metadataReader.getClassMetadata().getClassName()
|
||||
.equals(getClass().getName());
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public class AutoConfigureTestDatabaseWithNoDatabaseIntegrationTests {
|
||||
private ApplicationContext context;
|
||||
|
||||
@Test
|
||||
public void testContextLoads() throws Exception {
|
||||
public void testContextLoads() {
|
||||
// gh-6897
|
||||
assertThat(this.context).isNotNull();
|
||||
assertThat(this.context.getBeanNamesForType(DataSource.class)).isNotEmpty();
|
||||
|
||||
@@ -72,7 +72,7 @@ public class JooqTestIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void didNotInjectExampleComponent() throws Exception {
|
||||
public void didNotInjectExampleComponent() {
|
||||
this.thrown.expect(NoSuchBeanDefinitionException.class);
|
||||
this.applicationContext.getBean(ExampleComponent.class);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class JsonTestIntegrationTests {
|
||||
private JsonbTester<ExampleBasicObject> jsonbJson;
|
||||
|
||||
@Test
|
||||
public void basicJson() throws Exception {
|
||||
public void basicJson() {
|
||||
assertThat(this.basicJson.from("{\"a\":\"b\"}")).hasJsonPathStringValue("@.a");
|
||||
}
|
||||
|
||||
|
||||
@@ -55,22 +55,22 @@ public class JsonTestWithAutoConfigureJsonTestersTests {
|
||||
private JsonbTester<ExampleBasicObject> jsonbTester;
|
||||
|
||||
@Test
|
||||
public void basicJson() throws Exception {
|
||||
public void basicJson() {
|
||||
assertThat(this.basicJson).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void jackson() throws Exception {
|
||||
public void jackson() {
|
||||
assertThat(this.jacksonTester).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void gson() throws Exception {
|
||||
public void gson() {
|
||||
assertThat(this.gsonTester).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void jsonb() throws Exception {
|
||||
public void jsonb() {
|
||||
assertThat(this.jsonbTester).isNull();
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class DataJpaTestIntegrationTests {
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Test
|
||||
public void testEntityManager() throws Exception {
|
||||
public void testEntityManager() {
|
||||
ExampleEntity entity = this.entities.persist(new ExampleEntity("spring", "123"));
|
||||
this.entities.flush();
|
||||
Object id = this.entities.getId(entity);
|
||||
@@ -74,7 +74,7 @@ public class DataJpaTestIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEntityManagerPersistAndGetId() throws Exception {
|
||||
public void testEntityManagerPersistAndGetId() {
|
||||
Long id = this.entities.persistAndGetId(new ExampleEntity("spring", "123"),
|
||||
Long.class);
|
||||
assertThat(id).isNotNull();
|
||||
@@ -85,7 +85,7 @@ public class DataJpaTestIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRepository() throws Exception {
|
||||
public void testRepository() {
|
||||
this.entities.persist(new ExampleEntity("spring", "123"));
|
||||
this.entities.persist(new ExampleEntity("boot", "124"));
|
||||
this.entities.flush();
|
||||
@@ -101,7 +101,7 @@ public class DataJpaTestIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void didNotInjectExampleComponent() throws Exception {
|
||||
public void didNotInjectExampleComponent() {
|
||||
this.thrown.expect(NoSuchBeanDefinitionException.class);
|
||||
this.applicationContext.getBean(ExampleComponent.class);
|
||||
}
|
||||
|
||||
@@ -64,14 +64,14 @@ public class TestEntityManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void createWhenEntityManagerIsNullShouldThrowException() throws Exception {
|
||||
public void createWhenEntityManagerIsNullShouldThrowException() {
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
this.thrown.expectMessage("EntityManagerFactory must not be null");
|
||||
new TestEntityManager(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void persistAndGetIdShouldPersistAndGetId() throws Exception {
|
||||
public void persistAndGetIdShouldPersistAndGetId() {
|
||||
bindEntityManager();
|
||||
TestEntity entity = new TestEntity();
|
||||
given(this.persistenceUnitUtil.getIdentifier(entity)).willReturn(123);
|
||||
@@ -81,7 +81,7 @@ public class TestEntityManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void persistAndGetIdForTypeShouldPersistAndGetId() throws Exception {
|
||||
public void persistAndGetIdForTypeShouldPersistAndGetId() {
|
||||
bindEntityManager();
|
||||
TestEntity entity = new TestEntity();
|
||||
given(this.persistenceUnitUtil.getIdentifier(entity)).willReturn(123);
|
||||
@@ -91,7 +91,7 @@ public class TestEntityManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void persistShouldPersist() throws Exception {
|
||||
public void persistShouldPersist() {
|
||||
bindEntityManager();
|
||||
TestEntity entity = new TestEntity();
|
||||
TestEntity result = this.testEntityManager.persist(entity);
|
||||
@@ -100,7 +100,7 @@ public class TestEntityManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void persistAndFlushShouldPersistAndFlush() throws Exception {
|
||||
public void persistAndFlushShouldPersistAndFlush() {
|
||||
bindEntityManager();
|
||||
TestEntity entity = new TestEntity();
|
||||
TestEntity result = this.testEntityManager.persistAndFlush(entity);
|
||||
@@ -110,7 +110,7 @@ public class TestEntityManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void persistFlushFindShouldPersistAndFlushAndFind() throws Exception {
|
||||
public void persistFlushFindShouldPersistAndFlushAndFind() {
|
||||
bindEntityManager();
|
||||
TestEntity entity = new TestEntity();
|
||||
TestEntity found = new TestEntity();
|
||||
@@ -123,7 +123,7 @@ public class TestEntityManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeShouldMerge() throws Exception {
|
||||
public void mergeShouldMerge() {
|
||||
bindEntityManager();
|
||||
TestEntity entity = new TestEntity();
|
||||
given(this.entityManager.merge(entity)).willReturn(entity);
|
||||
@@ -133,7 +133,7 @@ public class TestEntityManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void removeShouldRemove() throws Exception {
|
||||
public void removeShouldRemove() {
|
||||
bindEntityManager();
|
||||
TestEntity entity = new TestEntity();
|
||||
this.testEntityManager.remove(entity);
|
||||
@@ -141,7 +141,7 @@ public class TestEntityManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void findShouldFind() throws Exception {
|
||||
public void findShouldFind() {
|
||||
bindEntityManager();
|
||||
TestEntity entity = new TestEntity();
|
||||
given(this.entityManager.find(TestEntity.class, 123)).willReturn(entity);
|
||||
@@ -150,14 +150,14 @@ public class TestEntityManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void flushShouldFlush() throws Exception {
|
||||
public void flushShouldFlush() {
|
||||
bindEntityManager();
|
||||
this.testEntityManager.flush();
|
||||
verify(this.entityManager).flush();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void refreshShouldRefresh() throws Exception {
|
||||
public void refreshShouldRefresh() {
|
||||
bindEntityManager();
|
||||
TestEntity entity = new TestEntity();
|
||||
this.testEntityManager.refresh(entity);
|
||||
@@ -165,14 +165,14 @@ public class TestEntityManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void clearShouldClear() throws Exception {
|
||||
public void clearShouldClear() {
|
||||
bindEntityManager();
|
||||
this.testEntityManager.clear();
|
||||
verify(this.entityManager).clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void detachShouldDetach() throws Exception {
|
||||
public void detachShouldDetach() {
|
||||
bindEntityManager();
|
||||
TestEntity entity = new TestEntity();
|
||||
this.testEntityManager.detach(entity);
|
||||
@@ -180,7 +180,7 @@ public class TestEntityManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getIdForTypeShouldGetId() throws Exception {
|
||||
public void getIdForTypeShouldGetId() {
|
||||
TestEntity entity = new TestEntity();
|
||||
given(this.persistenceUnitUtil.getIdentifier(entity)).willReturn(123);
|
||||
Integer result = this.testEntityManager.getId(entity, Integer.class);
|
||||
@@ -188,7 +188,7 @@ public class TestEntityManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getIdForTypeWhenTypeIsWrongShouldThrowException() throws Exception {
|
||||
public void getIdForTypeWhenTypeIsWrongShouldThrowException() {
|
||||
TestEntity entity = new TestEntity();
|
||||
given(this.persistenceUnitUtil.getIdentifier(entity)).willReturn(123);
|
||||
this.thrown.expectMessage("ID mismatch: Object of class [java.lang.Integer] "
|
||||
@@ -197,7 +197,7 @@ public class TestEntityManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getIdShouldGetId() throws Exception {
|
||||
public void getIdShouldGetId() {
|
||||
TestEntity entity = new TestEntity();
|
||||
given(this.persistenceUnitUtil.getIdentifier(entity)).willReturn(123);
|
||||
Object result = this.testEntityManager.getId(entity);
|
||||
@@ -205,14 +205,14 @@ public class TestEntityManagerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getEntityManagerShouldGetEntityManager() throws Exception {
|
||||
public void getEntityManagerShouldGetEntityManager() {
|
||||
bindEntityManager();
|
||||
assertThat(this.testEntityManager.getEntityManager())
|
||||
.isEqualTo(this.entityManager);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getEntityManagerWhenNotSetShouldThrowException() throws Exception {
|
||||
public void getEntityManagerWhenNotSetShouldThrowException() {
|
||||
this.thrown.expect(IllegalStateException.class);
|
||||
this.thrown.expectMessage("No transactional EntityManager found");
|
||||
this.testEntityManager.getEntityManager();
|
||||
|
||||
@@ -39,14 +39,14 @@ public class AnnotationsPropertySourceTests {
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
@Test
|
||||
public void createWhenSourceIsNullShouldThrowException() throws Exception {
|
||||
public void createWhenSourceIsNullShouldThrowException() {
|
||||
this.thrown.expect(IllegalArgumentException.class);
|
||||
this.thrown.expectMessage("Property source must not be null");
|
||||
new AnnotationsPropertySource(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesWhenHasNoAnnotationShouldBeEmpty() throws Exception {
|
||||
public void propertiesWhenHasNoAnnotationShouldBeEmpty() {
|
||||
AnnotationsPropertySource source = new AnnotationsPropertySource(
|
||||
NoAnnotation.class);
|
||||
assertThat(source.getPropertyNames()).isEmpty();
|
||||
@@ -54,16 +54,14 @@ public class AnnotationsPropertySourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesWhenHasTypeLevelAnnotationShouldUseAttributeName()
|
||||
throws Exception {
|
||||
public void propertiesWhenHasTypeLevelAnnotationShouldUseAttributeName() {
|
||||
AnnotationsPropertySource source = new AnnotationsPropertySource(TypeLevel.class);
|
||||
assertThat(source.getPropertyNames()).containsExactly("value");
|
||||
assertThat(source.getProperty("value")).isEqualTo("abc");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesWhenHasTypeLevelWithPrefixShouldUsePrefixedName()
|
||||
throws Exception {
|
||||
public void propertiesWhenHasTypeLevelWithPrefixShouldUsePrefixedName() {
|
||||
AnnotationsPropertySource source = new AnnotationsPropertySource(
|
||||
TypeLevelWithPrefix.class);
|
||||
assertThat(source.getPropertyNames()).containsExactly("test.value");
|
||||
@@ -71,8 +69,7 @@ public class AnnotationsPropertySourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesWhenHasAttributeLevelWithPrefixShouldUsePrefixedName()
|
||||
throws Exception {
|
||||
public void propertiesWhenHasAttributeLevelWithPrefixShouldUsePrefixedName() {
|
||||
AnnotationsPropertySource source = new AnnotationsPropertySource(
|
||||
AttributeLevelWithPrefix.class);
|
||||
assertThat(source.getPropertyNames()).containsExactly("test");
|
||||
@@ -80,8 +77,7 @@ public class AnnotationsPropertySourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesWhenHasTypeAndAttributeLevelWithPrefixShouldUsePrefixedName()
|
||||
throws Exception {
|
||||
public void propertiesWhenHasTypeAndAttributeLevelWithPrefixShouldUsePrefixedName() {
|
||||
AnnotationsPropertySource source = new AnnotationsPropertySource(
|
||||
TypeAndAttributeLevelWithPrefix.class);
|
||||
assertThat(source.getPropertyNames()).containsExactly("test.example");
|
||||
@@ -89,8 +85,7 @@ public class AnnotationsPropertySourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesWhenNotMappedAtTypeLevelShouldIgnoreAttributes()
|
||||
throws Exception {
|
||||
public void propertiesWhenNotMappedAtTypeLevelShouldIgnoreAttributes() {
|
||||
AnnotationsPropertySource source = new AnnotationsPropertySource(
|
||||
NotMappedAtTypeLevel.class);
|
||||
assertThat(source.getPropertyNames()).containsExactly("value");
|
||||
@@ -98,8 +93,7 @@ public class AnnotationsPropertySourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesWhenNotMappedAtAttributeLevelShouldIgnoreAttributes()
|
||||
throws Exception {
|
||||
public void propertiesWhenNotMappedAtAttributeLevelShouldIgnoreAttributes() {
|
||||
AnnotationsPropertySource source = new AnnotationsPropertySource(
|
||||
NotMappedAtAttributeLevel.class);
|
||||
assertThat(source.getPropertyNames()).containsExactly("value");
|
||||
@@ -107,7 +101,7 @@ public class AnnotationsPropertySourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesWhenContainsArraysShouldExpandNames() throws Exception {
|
||||
public void propertiesWhenContainsArraysShouldExpandNames() {
|
||||
AnnotationsPropertySource source = new AnnotationsPropertySource(Arrays.class);
|
||||
assertThat(source.getPropertyNames()).contains("strings[0]", "strings[1]",
|
||||
"classes[0]", "classes[1]", "ints[0]", "ints[1]", "longs[0]", "longs[1]",
|
||||
@@ -130,14 +124,14 @@ public class AnnotationsPropertySourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesWhenHasCamelCaseShouldConvertToKebabCase() throws Exception {
|
||||
public void propertiesWhenHasCamelCaseShouldConvertToKebabCase() {
|
||||
AnnotationsPropertySource source = new AnnotationsPropertySource(
|
||||
CamelCaseToKebabCase.class);
|
||||
assertThat(source.getPropertyNames()).contains("camel-case-to-kebab-case");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesFromMetaAnnotationsAreMapped() throws Exception {
|
||||
public void propertiesFromMetaAnnotationsAreMapped() {
|
||||
AnnotationsPropertySource source = new AnnotationsPropertySource(
|
||||
PropertiesFromSingleMetaAnnotation.class);
|
||||
assertThat(source.getPropertyNames()).containsExactly("value");
|
||||
@@ -145,8 +139,7 @@ public class AnnotationsPropertySourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesFromMultipleMetaAnnotationsAreMappedUsingTheirOwnPropertyMapping()
|
||||
throws Exception {
|
||||
public void propertiesFromMultipleMetaAnnotationsAreMappedUsingTheirOwnPropertyMapping() {
|
||||
AnnotationsPropertySource source = new AnnotationsPropertySource(
|
||||
PropertiesFromMultipleMetaAnnotations.class);
|
||||
assertThat(source.getPropertyNames()).containsExactly("value", "test.value",
|
||||
@@ -186,14 +179,14 @@ public class AnnotationsPropertySourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void enumValueMapped() throws Exception {
|
||||
public void enumValueMapped() {
|
||||
AnnotationsPropertySource source = new AnnotationsPropertySource(
|
||||
EnumValueMapped.class);
|
||||
assertThat(source.getProperty("testenum.value")).isEqualTo(EnumItem.TWO);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void enumValueNotMapped() throws Exception {
|
||||
public void enumValueNotMapped() {
|
||||
AnnotationsPropertySource source = new AnnotationsPropertySource(
|
||||
EnumValueNotMapped.class);
|
||||
assertThat(source.containsProperty("testenum.value")).isFalse();
|
||||
|
||||
@@ -78,7 +78,7 @@ public class PropertyMappingContextCustomizerFactoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hashCodeAndEqualsShouldBeBasedOnPropertyValues() throws Exception {
|
||||
public void hashCodeAndEqualsShouldBeBasedOnPropertyValues() {
|
||||
ContextCustomizer customizer1 = this.factory
|
||||
.createContextCustomizer(TypeMapping.class, null);
|
||||
ContextCustomizer customizer2 = this.factory
|
||||
@@ -91,7 +91,7 @@ public class PropertyMappingContextCustomizerFactoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void prepareContextShouldAddPropertySource() throws Exception {
|
||||
public void prepareContextShouldAddPropertySource() {
|
||||
ContextCustomizer customizer = this.factory
|
||||
.createContextCustomizer(AttributeMapping.class, null);
|
||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
|
||||
@@ -100,7 +100,7 @@ public class PropertyMappingContextCustomizerFactoryTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertyMappingShouldNotBeUsedWithComponent() throws Exception {
|
||||
public void propertyMappingShouldNotBeUsedWithComponent() {
|
||||
ContextCustomizer customizer = this.factory
|
||||
.createContextCustomizer(AttributeMapping.class, null);
|
||||
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
|
||||
|
||||
@@ -38,7 +38,7 @@ public class PropertyMappingTests {
|
||||
private Environment environment;
|
||||
|
||||
@Test
|
||||
public void hasProperty() throws Exception {
|
||||
public void hasProperty() {
|
||||
assertThat(this.environment.getProperty("example-property")).isEqualTo("abc");
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class RestAssuredRestDocsAutoConfigurationAdvancedConfigurationIntegratio
|
||||
private RequestSpecification documentationSpec;
|
||||
|
||||
@Test
|
||||
public void snippetGeneration() throws Exception {
|
||||
public void snippetGeneration() {
|
||||
given(this.documentationSpec)
|
||||
.filter(document("default-snippets",
|
||||
preprocessRequest(modifyUris().scheme("https")
|
||||
|
||||
@@ -60,7 +60,7 @@ public class RestAssuredRestDocsAutoConfigurationIntegrationTests {
|
||||
private RequestSpecification documentationSpec;
|
||||
|
||||
@Test
|
||||
public void defaultSnippetsAreWritten() throws Exception {
|
||||
public void defaultSnippetsAreWritten() {
|
||||
given(this.documentationSpec)
|
||||
.filter(document("default-snippets",
|
||||
preprocessRequest(modifyUris().scheme("https")
|
||||
|
||||
@@ -39,7 +39,7 @@ public class AutoConfigureMockRestServiceServerEnabledFalseIntegrationTests {
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Test(expected = NoSuchBeanDefinitionException.class)
|
||||
public void mockServerRestTemplateCustomizerShouldNotBeRegistered() throws Exception {
|
||||
public void mockServerRestTemplateCustomizerShouldNotBeRegistered() {
|
||||
this.applicationContext.getBean(MockServerRestTemplateCustomizer.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class AutoConfigureWebClientWithRestTemplateIntegrationTests {
|
||||
private MockRestServiceServer server;
|
||||
|
||||
@Test
|
||||
public void restTemplateTest() throws Exception {
|
||||
public void restTemplateTest() {
|
||||
this.server.expect(requestTo("/test"))
|
||||
.andRespond(withSuccess("hello", MediaType.TEXT_HTML));
|
||||
ResponseEntity<String> entity = this.restTemplate.getForEntity("/test",
|
||||
|
||||
@@ -45,21 +45,21 @@ public class RestClientRestIntegrationTests {
|
||||
private ExampleRestClient client;
|
||||
|
||||
@Test
|
||||
public void mockServerCall1() throws Exception {
|
||||
public void mockServerCall1() {
|
||||
this.server.expect(requestTo("/test"))
|
||||
.andRespond(withSuccess("1", MediaType.TEXT_HTML));
|
||||
assertThat(this.client.test()).isEqualTo("1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mockServerCall2() throws Exception {
|
||||
public void mockServerCall2() {
|
||||
this.server.expect(requestTo("/test"))
|
||||
.andRespond(withSuccess("2", MediaType.TEXT_HTML));
|
||||
assertThat(this.client.test()).isEqualTo("2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mockServerCallWithContent() throws Exception {
|
||||
public void mockServerCallWithContent() {
|
||||
this.server.expect(requestTo("/test")).andExpect(content().string("test"))
|
||||
.andRespond(withSuccess("1", MediaType.TEXT_HTML));
|
||||
this.client.testPostWithBody("test");
|
||||
|
||||
@@ -50,12 +50,12 @@ public class RestClientTestNoComponentIntegrationTests {
|
||||
private MockRestServiceServer server;
|
||||
|
||||
@Test(expected = NoSuchBeanDefinitionException.class)
|
||||
public void exampleRestClientIsNotInjected() throws Exception {
|
||||
public void exampleRestClientIsNotInjected() {
|
||||
this.applicationContext.getBean(ExampleRestClient.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void manuallyCreateBean() throws Exception {
|
||||
public void manuallyCreateBean() {
|
||||
ExampleRestClient client = new ExampleRestClient(this.restTemplateBuilder);
|
||||
this.server.expect(requestTo("/test"))
|
||||
.andRespond(withSuccess("hello", MediaType.TEXT_HTML));
|
||||
|
||||
@@ -56,7 +56,7 @@ public class RestClientTestTwoComponentsIntegrationTests {
|
||||
private MockRestServiceServer server;
|
||||
|
||||
@Test
|
||||
public void serverShouldNotWork() throws Exception {
|
||||
public void serverShouldNotWork() {
|
||||
this.thrown.expect(IllegalStateException.class);
|
||||
this.thrown.expectMessage("Unable to use auto-configured");
|
||||
this.server.expect(requestTo("/test"))
|
||||
@@ -64,7 +64,7 @@ public class RestClientTestTwoComponentsIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void client1RestCallViaCustomizer() throws Exception {
|
||||
public void client1RestCallViaCustomizer() {
|
||||
this.customizer.getServer(this.client1.getRestTemplate())
|
||||
.expect(requestTo("/test"))
|
||||
.andRespond(withSuccess("hello", MediaType.TEXT_HTML));
|
||||
@@ -72,7 +72,7 @@ public class RestClientTestTwoComponentsIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void client2RestCallViaCustomizer() throws Exception {
|
||||
public void client2RestCallViaCustomizer() {
|
||||
this.customizer.getServer(this.client2.getRestTemplate())
|
||||
.expect(requestTo("/test"))
|
||||
.andRespond(withSuccess("there", MediaType.TEXT_HTML));
|
||||
|
||||
@@ -44,7 +44,7 @@ public class RestClientTestWithComponentIntegrationTests {
|
||||
private ExampleRestClient client;
|
||||
|
||||
@Test
|
||||
public void mockServerCall() throws Exception {
|
||||
public void mockServerCall() {
|
||||
this.server.expect(requestTo("/test"))
|
||||
.andRespond(withSuccess("hello", MediaType.TEXT_HTML));
|
||||
assertThat(this.client.test()).isEqualTo("hello");
|
||||
|
||||
@@ -57,7 +57,7 @@ public class WebTestClientAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCustomizeClientCodecs() throws Exception {
|
||||
public void shouldCustomizeClientCodecs() {
|
||||
load(CodecConfiguration.class);
|
||||
WebTestClient webTestClient = this.context.getBean(WebTestClient.class);
|
||||
CodecCustomizer codecCustomizer = this.context.getBean(CodecCustomizer.class);
|
||||
@@ -66,7 +66,7 @@ public class WebTestClientAutoConfigurationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldCustomizeTimeout() throws Exception {
|
||||
public void shouldCustomizeTimeout() {
|
||||
PropertySource<?> propertySource = new MapPropertySource("test", Collections
|
||||
.singletonMap("spring.test.webtestclient.timeout", (Object) "PT15M"));
|
||||
load(propertySource, BaseConfiguration.class);
|
||||
|
||||
@@ -64,7 +64,7 @@ public class WebTestClientSpringBootTestIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldHaveRealService() throws Exception {
|
||||
public void shouldHaveRealService() {
|
||||
assertThat(this.applicationContext.getBeansOfType(ExampleRealService.class))
|
||||
.hasSize(1);
|
||||
}
|
||||
@@ -73,8 +73,7 @@ public class WebTestClientSpringBootTestIntegrationTests {
|
||||
static class TestConfiguration {
|
||||
|
||||
@Bean
|
||||
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http)
|
||||
throws Exception {
|
||||
public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
|
||||
http.authorizeExchange().anyExchange().permitAll();
|
||||
return http.build();
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class MockMvcSpringBootTestIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldHaveRealService() throws Exception {
|
||||
public void shouldHaveRealService() {
|
||||
assertThat(this.applicationContext.getBean(ExampleRealService.class)).isNotNull();
|
||||
}
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ public class WebMvcTestAllControllersIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotFilterErrorAttributes() throws Exception {
|
||||
public void shouldNotFilterErrorAttributes() {
|
||||
assertThat(this.errorAttributes).isNotNull();
|
||||
|
||||
}
|
||||
|
||||
@@ -53,12 +53,12 @@ public class WebMvcTestWebDriverCustomScopeIntegrationTests {
|
||||
private WebDriver webDriver;
|
||||
|
||||
@Test
|
||||
public void shouldAutoConfigureWebClient() throws Exception {
|
||||
public void shouldAutoConfigureWebClient() {
|
||||
WebMvcTestWebDriverCustomScopeIntegrationTests.previousWebDriver = this.webDriver;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldBeTheSameWebClient() throws Exception {
|
||||
public void shouldBeTheSameWebClient() {
|
||||
assertThat(previousWebDriver).isNotNull().isSameAs(this.webDriver);
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class WebMvcTestWebDriverCustomScopeIntegrationTests {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebDriver getObject() throws Exception {
|
||||
public WebDriver getObject() {
|
||||
return this.driver;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ public class WebMvcTestWebDriverIntegrationTests {
|
||||
private WebDriver webDriver;
|
||||
|
||||
@Test
|
||||
public void shouldAutoConfigureWebClient() throws Exception {
|
||||
public void shouldAutoConfigureWebClient() {
|
||||
this.webDriver.get("/html");
|
||||
WebElement element = this.webDriver.findElement(By.tagName("body"));
|
||||
assertThat(element.getText()).isEqualTo("Hello");
|
||||
@@ -57,7 +57,7 @@ public class WebMvcTestWebDriverIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldBeADifferentWebClient() throws Exception {
|
||||
public void shouldBeADifferentWebClient() {
|
||||
this.webDriver.get("/html");
|
||||
WebElement element = this.webDriver.findElement(By.tagName("body"));
|
||||
assertThat(element.getText()).isEqualTo("Hello");
|
||||
|
||||
@@ -60,13 +60,13 @@ public class WebMvcTestWithAutoConfigureMockMvcIntegrationTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotHaveWebDriver() throws Exception {
|
||||
public void shouldNotHaveWebDriver() {
|
||||
this.thrown.expect(NoSuchBeanDefinitionException.class);
|
||||
this.context.getBean(WebDriver.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotHaveWebClient() throws Exception {
|
||||
public void shouldNotHaveWebClient() {
|
||||
this.thrown.expect(NoSuchBeanDefinitionException.class);
|
||||
this.context.getBean(WebClient.class);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user