use of org.springframework.core.io.ByteArrayResource in project spring-framework by spring-projects.
the class ResourceRegionEncoderTests method shouldEncodeMultipleResourceRegionsByteArrayResource.
@Test
public void shouldEncodeMultipleResourceRegionsByteArrayResource() throws Exception {
String content = "Spring Framework test resource content.";
shouldEncodeMultipleResourceRegions(new ByteArrayResource(content.getBytes(StandardCharsets.UTF_8)));
}
use of org.springframework.core.io.ByteArrayResource in project spring-boot by spring-projects.
the class ResourceBannerTests method renderWithoutFormattedVersions.
@Test
public void renderWithoutFormattedVersions() throws Exception {
Resource resource = new ByteArrayResource("banner ${a}${spring-boot.formatted-version}${application.formatted-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 renderVersions.
@Test
public void renderVersions() throws Exception {
Resource resource = new ByteArrayResource("banner ${a} ${spring-boot.version} ${application.version}".getBytes());
String banner = printBanner(resource, "10.2", "2.0", null);
assertThat(banner).startsWith("banner 1 10.2 2.0");
}
use of org.springframework.core.io.ByteArrayResource in project spring-boot by spring-projects.
the class ResourceBannerTests method renderWithTitle.
@Test
public void renderWithTitle() throws Exception {
Resource resource = new ByteArrayResource("banner ${application.title} ${a}".getBytes());
String banner = printBanner(resource, null, null, "title");
assertThat(banner).startsWith("banner title 1");
}
use of org.springframework.core.io.ByteArrayResource in project spring-boot by spring-projects.
the class ResourceBannerTests method renderWithColorsButDisabled.
@Test
public void renderWithColorsButDisabled() throws Exception {
Resource resource = new ByteArrayResource("${Ansi.RED}This is red.${Ansi.NORMAL}".getBytes());
AnsiOutput.setEnabled(AnsiOutput.Enabled.NEVER);
String banner = printBanner(resource, null, null, null);
assertThat(banner).startsWith("This is red.");
}
Aggregations