Polishing

This commit is contained in:
Sam Brannen
2022-06-01 14:57:16 +02:00
parent d9d45cc0b1
commit bc3b3d01ee
12 changed files with 68 additions and 68 deletions

View File

@@ -138,6 +138,7 @@ class DefaultBeanRegistrationCodeFragments extends BeanRegistrationCodeFragments
return null;
}
@Override
public CodeBlock generateSetBeanInstanceSupplierCode(
GenerationContext generationContext,
BeanRegistrationCode beanRegistrationCode, CodeBlock instanceSupplierCode,

View File

@@ -196,7 +196,7 @@ class BeanDefinitionMethodGeneratorTests {
RootBeanDefinition beanDefinition,
Predicate<String> attributeFilter) {
return super.generateSetBeanDefinitionPropertiesCode(generationContext,
beanRegistrationCode, beanDefinition, name -> "a".equals(name));
beanRegistrationCode, beanDefinition, "a"::equals);
}
};

View File

@@ -371,7 +371,7 @@ class BeanDefinitionPropertiesCodeGeneratorTests {
void attributesWhenSomeFiltered() {
this.beanDefinition.setAttribute("a", "A");
this.beanDefinition.setAttribute("b", "B");
Predicate<String> attributeFilter = attribute -> "a".equals(attribute);
Predicate<String> attributeFilter = "a"::equals;
this.generator = new BeanDefinitionPropertiesCodeGenerator(this.hints,
attributeFilter, this.generatedMethods, (name, value) -> null);
testCompiledResult(this.beanDefinition, (actual, compiled) -> {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2019 the original author or authors.
* Copyright 2002-2022 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.
@@ -38,7 +38,7 @@ public class DefaultSingletonBeanRegistryTests {
beanRegistry.registerSingleton("tb", tb);
assertThat(beanRegistry.getSingleton("tb")).isSameAs(tb);
TestBean tb2 = (TestBean) beanRegistry.getSingleton("tb2", () -> new TestBean());
TestBean tb2 = (TestBean) beanRegistry.getSingleton("tb2", TestBean::new);
assertThat(beanRegistry.getSingleton("tb2")).isSameAs(tb2);
assertThat(beanRegistry.getSingleton("tb")).isSameAs(tb);