@@ -42,6 +42,7 @@ public class PostProcessingConfigTest {
4242 private static final String NEW_FILES = PostProcessingConfig .TAG_NAME_NEW_FILES ;
4343 private static final String OUTPUT_DIR = PostProcessingConfig .TAG_NAME_OUTPUT_DIR ;
4444 private static final String OVERWRITE = PostProcessingConfig .TAG_NAME_OVERWRITE ;
45+ private static final String MATCHUP_DIM = PostProcessingConfig .TAG_NAME_MATCHUP_DIMENSION ;
4546
4647 private static final String DUMMY_NAME = DummyPostProcessingPlugin .DUMMY_POST_PROCESSING_NAME ;
4748 private Element root ;
@@ -77,7 +78,32 @@ public void testStore() throws Exception {
7778 pw .println (" <" + DUMMY_NAME + ">C</" + DUMMY_NAME + ">" );
7879 pw .println (" </post-processings>" );
7980 pw .println ("</post-processing-config>" );
80- // pw.println();
81+ pw .flush ();
82+
83+ assertEquals (sw .toString ().replaceAll ("\\ s+" ,"" ), outputStream .toString ().replaceAll ("\\ s+" ,"" ));
84+ }
85+
86+ @ Test
87+ public void testStoreWithMatchup () throws Exception {
88+ final ByteArrayOutputStream outputStream = new ByteArrayOutputStream ();
89+ getConfigWithMatchupDimension ("matching" ).store (outputStream );
90+
91+ final StringWriter sw = new StringWriter ();
92+ final PrintWriter pw = new PrintWriter (sw );
93+ pw .println ("<?xml version=\" 1.0\" encoding=\" UTF-8\" ?>" );
94+ pw .println ("<post-processing-config>" );
95+ pw .println (" <create-new-files>" );
96+ pw .println (" <output-directory>An_Output_Directory</output-directory>" );
97+ pw .println (" </create-new-files>" );
98+ pw .println (" <post-processings>" );
99+ pw .println (" <" + DUMMY_NAME + ">A</" + DUMMY_NAME + ">" );
100+ pw .println (" <" + DUMMY_NAME + ">B</" + DUMMY_NAME + ">" );
101+ pw .println (" <" + DUMMY_NAME + ">C</" + DUMMY_NAME + ">" );
102+ pw .println (" </post-processings>" );
103+ pw .println (" <matchup-dimension-name>" );
104+ pw .println (" matching" );
105+ pw .println (" </matchup-dimension-name>" );
106+ pw .println ("</post-processing-config>" );
81107 pw .flush ();
82108
83109 assertEquals (sw .toString ().replaceAll ("\\ s+" ,"" ), outputStream .toString ().replaceAll ("\\ s+" ,"" ));
@@ -117,6 +143,13 @@ public void testLoad_createNewFiles() throws Exception {
117143 assertEquals ("An_Output_Directory" , config .getOutputDirectory ());
118144 }
119145
146+ @ Test
147+ public void testLoad_matchupDimension () throws Exception {
148+ final PostProcessingConfig config = getConfigWithMatchupDimension ("theDimension" );
149+
150+ assertEquals ("theDimension" , config .getMatchupDimensionName ());
151+ }
152+
120153 @ Test
121154 public void testLoad_overwrite () throws Exception {
122155 root .removeChild (NEW_FILES );
@@ -217,4 +250,10 @@ private PostProcessingConfig getConfig() throws Exception {
217250
218251 return PostProcessingConfig .load (new ByteArrayInputStream (bs .toByteArray ()));
219252 }
253+
254+ private PostProcessingConfig getConfigWithMatchupDimension (String dimensionName ) throws Exception {
255+ root .addContent (new Element (MATCHUP_DIM ).addContent (dimensionName ));
256+
257+ return getConfig ();
258+ }
220259}
0 commit comments