package io.dropwizard.configuration;

import io.dropwizard.util.CharStreams;
import org.junit.jupiter.api.Test;

import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;

import static org.assertj.core.api.Assertions.assertThat;

class ResourceConfigurationSourceProviderTest {
    private final ConfigurationSourceProvider provider = new ResourceConfigurationSourceProvider();

    @Test
    void readsFileContents() throws Exception {
        assertForWheeContent("example.txt");
        assertForWheeContent("io/dropwizard/configuration/not-root-example.txt");
        assertForWheeContent("/io/dropwizard/configuration/not-root-example.txt");
    }

    private void assertForWheeContent(String path) throws Exception {
        assertThat(loadResourceAsString(path)).isEqualToIgnoringWhitespace("whee");
    }

    private String loadResourceAsString(String path) throws Exception {
        try (InputStream inputStream = provider.open(path)) {
            return CharStreams.toString(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
        }
    }
}

@@ -42,144 +42,120 @@
 ort 
-io.dropwizard.util.CharStreams;%0Aimport org.junit.jupiter.api.Test;%0A%0Aimport java.io.InputStream;%0Aimport java.io.InputStreamReader;%0Aimport
+org.junit.jupiter.params.ParameterizedTest;%0Aimport org.junit.jupiter.params.provider.ValueSource;%0A%0Aimport static
  jav
@@ -184,18 +184,23 @@
 Charsets
+.UTF_8
 ;
-%0A
 %0Aimport 
@@ -409,90 +409,63 @@
    @
-Test%0A    void readsFileContents() throws Exception %7B%0A        assertForWheeContent(
+ParameterizedTest%0A    @ValueSource(strings = %7B%0A        
 %22exa
@@ -465,34 +465,33 @@
    %22example.txt%22
-);
+,
 %0A        assertF
@@ -483,37 +483,16 @@
         
-assertForWheeContent(
 %22io/drop
@@ -529,26 +529,25 @@
 example.txt%22
-);
+,
 %0A        ass
@@ -543,37 +543,16 @@
         
-assertForWheeContent(
 %22/io/dro
@@ -598,55 +598,41 @@
 txt%22
-);
 %0A    %7D
-%0A
+)
 %0A    
-private void assertForWhe
+void readsFil
 eContent
 (Str
@@ -627,16 +627,17 @@
 eContent
+s
 (String 
@@ -684,324 +684,107 @@
 hat(
-loadResourceAsString(path)).isEqualToIgnoringWhitespace(%22whee%22);
+provider.open(path))
 %0A    
-%7D%0A%0A
+  
     
-private String loadResourceAsString(String path) throws Exception %7B%0A        try (InputStream inputStream = provider.open(path)) %7B%0A            return CharStreams.toString(new InputStreamReader(inputStream, StandardCharsets.UTF_8));%0A        %7D
+  .asString(UTF_8)%0A            .isEqualToIgnoringWhitespace(%22whee%22);
 %0A   

Simplify ResourceConfigurationSourceProviderTest