1111import com .swisscom .daisy .cosmos .candyfloss .config .JsonKStreamApplicationConfig ;
1212import com .swisscom .daisy .cosmos .candyfloss .config .PipelineStepConfig ;
1313import com .swisscom .daisy .cosmos .candyfloss .config .exceptions .InvalidConfigurations ;
14- import com .swisscom .daisy .cosmos .candyfloss .testutils .OutputUpdaterUtils ;
1514import com .swisscom .daisy .cosmos .candyfloss .testutils .JsonUtil ;
15+ import com .swisscom .daisy .cosmos .candyfloss .testutils .OutputUpdaterUtils ;
1616import com .swisscom .daisy .cosmos .candyfloss .transformations .match .exceptions .InvalidMatchConfiguration ;
1717import com .typesafe .config .Config ;
1818import com .typesafe .config .ConfigFactory ;
@@ -42,7 +42,8 @@ abstract class AbstractDeploymentTest {
4242 private final Logger logger = LoggerFactory .getLogger (AbstractDeploymentTest .class );
4343 private static final String UPDATE_DEPLOYMENT_RESOURCE = "candyfloss.updateDeploymentResource" ;
4444 private static final String COMMENT_TRAILING_ANCHOR = "__COMMENT_TRAILING__" ;
45- private static final Pattern FIELD_NAME_PATTERN = Pattern .compile ("^\" ((?:\\ \\ .|[^\" \\ \\ ])+)\" \\ s*:" );
45+ private static final Pattern FIELD_NAME_PATTERN =
46+ Pattern .compile ("^\" ((?:\\ \\ .|[^\" \\ \\ ])+)\" \\ s*:" );
4647 protected final ObjectMapper objectMapper = new ObjectMapper (factory );
4748 protected static final String DISCARD_TEST = "discard" ;
4849 protected JsonKStreamApplicationConfig appConf ;
@@ -96,7 +97,8 @@ protected void checkOutput(TestOutputTopic<String, String> topic, Path expectedO
9697 return ;
9798 }
9899
99- final Optional <List <Map <String , Object >>> expectedOutput = getExpectedOutput (expectedOutputPath );
100+ final Optional <List <Map <String , Object >>> expectedOutput =
101+ getExpectedOutput (expectedOutputPath );
100102 if (expectedOutput .isPresent ()) {
101103 var expected = expectedOutput .get ();
102104 assertEquals (
@@ -122,17 +124,17 @@ protected void checkOutput(TestOutputTopic<String, String> topic, Path expectedO
122124
123125 // only update output files if it originally exists and flag is set
124126 protected boolean shouldUpdateDeployment (Path expectedOutputPath ) {
125- return Boolean .parseBoolean (System .getProperty (UPDATE_DEPLOYMENT_RESOURCE , "false" )) &&
126- Files .exists (expectedOutputPath );
127+ return Boolean .parseBoolean (System .getProperty (UPDATE_DEPLOYMENT_RESOURCE , "false" ))
128+ && Files .exists (expectedOutputPath );
127129 }
128130
129- private void writeExpectedOutput (Path expectedOutputPath ,
130- List < KeyValue < String , String >> returned ) throws IOException {
131+ private void writeExpectedOutput (Path expectedOutputPath , List < KeyValue < String , String >> returned )
132+ throws IOException {
131133 JsonNode currentOutputTree = null ;
132134 String originalContent = "" ;
133135 if (Files .exists (expectedOutputPath )) {
134- originalContent = Files .readString (expectedOutputPath );
135- currentOutputTree = objectMapper .readTree (originalContent );
136+ originalContent = Files .readString (expectedOutputPath );
137+ currentOutputTree = objectMapper .readTree (originalContent );
136138 }
137139
138140 JsonNode outputToWrite ;
@@ -152,7 +154,7 @@ private void writeExpectedOutput(Path expectedOutputPath,
152154 }
153155
154156 OutputUpdaterUtils .writeExpectedOutput (
155- expectedOutputPath , originalContent , currentOutputTree , outputToWrite , objectMapper );
157+ expectedOutputPath , originalContent , currentOutputTree , outputToWrite , objectMapper );
156158 }
157159
158160 /*** For a given path, extract all files that their name ends with an `ending`, used for automatic test files discovery.*/
@@ -166,7 +168,8 @@ private Map<Integer, Path> extractFiles(Path path, String ending) throws IOExcep
166168 }
167169
168170 /*** Read the expected JSON output and convert it to List of JSON objects, for easier compare during testing */
169- protected Optional <List <Map <String , Object >>> getExpectedOutput (Path resourcePath ) throws IOException {
171+ protected Optional <List <Map <String , Object >>> getExpectedOutput (Path resourcePath )
172+ throws IOException {
170173 if (!Files .exists (resourcePath )) {
171174 return Optional .empty ();
172175 }
0 commit comments