use of org.springframework.core.io.ByteArrayResource in project spring-boot by spring-projects.
the class PropertiesConfigurationFactoryMapTests method bindFoo.
private Foo bindFoo(final String values) throws Exception {
Properties properties = PropertiesLoaderUtils.loadProperties(new ByteArrayResource(values.getBytes()));
MutablePropertySources propertySources = new MutablePropertySources();
propertySources.addFirst(new PropertiesPropertySource("test", properties));
this.factory.setPropertySources(propertySources);
this.factory.afterPropertiesSet();
return this.factory.getObject();
}
use of org.springframework.core.io.ByteArrayResource in project spring-boot by spring-projects.
the class PropertiesConfigurationFactoryParameterizedTests method bindFoo.
private Foo bindFoo(final String values) throws Exception {
Properties properties = PropertiesLoaderUtils.loadProperties(new ByteArrayResource(values.getBytes()));
MutablePropertySources propertySources = new MutablePropertySources();
propertySources.addFirst(new PropertiesPropertySource("test", properties));
this.factory.setPropertySources(propertySources);
this.factory.afterPropertiesSet();
return this.factory.getObject();
}
use of org.springframework.core.io.ByteArrayResource in project spring-boot by spring-projects.
the class ResourceBannerTests method renderFormattedVersions.
@Test
public void renderFormattedVersions() throws Exception {
Resource resource = new ByteArrayResource("banner ${a}${spring-boot.formatted-version}${application.formatted-version}".getBytes());
String banner = printBanner(resource, "10.2", "2.0", null);
assertThat(banner).startsWith("banner 1 (v10.2) (v2.0)");
}
use of org.springframework.core.io.ByteArrayResource in project spring-boot by spring-projects.
the class ResourceBannerTests method renderWithoutVersions.
@Test
public void renderWithoutVersions() throws Exception {
Resource resource = new ByteArrayResource("banner ${a} ${spring-boot.version} ${application.version}".getBytes());
String banner = printBanner(resource, null, null, null);
assertThat(banner).startsWith("banner 1 ");
}
use of org.springframework.core.io.ByteArrayResource in project spring-boot by spring-projects.
the class ResourceBannerTests method renderWithColors.
@Test
public void renderWithColors() throws Exception {
Resource resource = new ByteArrayResource("${Ansi.RED}This is red.${Ansi.NORMAL}".getBytes());
AnsiOutput.setEnabled(AnsiOutput.Enabled.ALWAYS);
String banner = printBanner(resource, null, null, null);
assertThat(banner).startsWith("[31mThis is red.[0m");
}
Aggregations