@@ -208,42 +208,6 @@ public void shouldGenerateCustomPropertiesFileProperties(boolean useNativeGit) t
208208 @ Test
209209 @ Parameters (method = "useNativeGit" )
210210 public void shouldGenerateCustomPropertiesFileJson (boolean useNativeGit ) throws Exception {
211- // given
212- mavenSandbox .withParentProject ("my-pom-project" , "pom" )
213- .withChildProject ("my-jar-module" , "jar" )
214- .withGitRepoInChild (AvailableGitTestRepo .GIT_COMMIT_ID )
215- .create (CleanUp .CLEANUP_FIRST );
216-
217- MavenProject targetProject = mavenSandbox .getChildProject ();
218-
219- String targetFilePath = "target/classes/custom-git.properties" ;
220- File expectedFile = new File (targetProject .getBasedir (), targetFilePath );
221-
222- setProjectToExecuteMojoIn (targetProject );
223- alterMojoSettings ("generateGitPropertiesFile" , true );
224- alterMojoSettings ("generateGitPropertiesFilename" , targetFilePath );
225- alterMojoSettings ("format" , "json" );
226- alterMojoSettings ("useNativeGit" , useNativeGit );
227-
228- // when
229- try {
230- mojo .execute ();
231-
232- // then
233- assertThat (expectedFile ).exists ();
234- String json = Files .toString (expectedFile , Charset .defaultCharset ());
235- ObjectMapper om = new ObjectMapper ();
236- Map <String , String > map = new HashMap <String , String >();
237- map = om .readValue (expectedFile , map .getClass ());
238- assertThat (map .size () > 10 );
239- } finally {
240- FileUtils .forceDelete (expectedFile );
241- }
242- }
243-
244- @ Test
245- @ Parameters (value = {"UTF-8" , "ISO-8859-1" })
246- public void shouldGenerateCustomPropertiesFileJsonWithCustomEncoding (String encoding ) throws Exception {
247211 // given
248212 mavenSandbox .withParentProject ("my-pom-project" , "pom" )
249213 .withChildProject ("my-jar-module" , "jar" )
@@ -254,21 +218,19 @@ public void shouldGenerateCustomPropertiesFileJsonWithCustomEncoding(String enco
254218
255219 String targetFilePath = "target/classes/custom-git.properties" ;
256220 File expectedFile = new File (targetProject .getBasedir (), targetFilePath );
257- Charset charset = Charset .forName (encoding );
258221
259222 setProjectToExecuteMojoIn (targetProject );
260223 alterMojoSettings ("generateGitPropertiesFile" , true );
261224 alterMojoSettings ("generateGitPropertiesFilename" , targetFilePath );
262225 alterMojoSettings ("format" , "json" );
263- alterMojoSettings ("useNativeGit" , true );
264- alterMojoSettings ("encoding" , charset .name ());
226+ alterMojoSettings ("useNativeGit" , useNativeGit );
265227 // when
266228 try {
267229 mojo .execute ();
268230
269231 // then
270232 assertThat (expectedFile ).exists ();
271- String json = Files .toString (expectedFile , charset );
233+ String json = Files .toString (expectedFile , Charset . forName ( "UTF-8" ) );
272234 ObjectMapper om = new ObjectMapper ();
273235 Map <String , String > map = new HashMap <String , String >();
274236 map = om .readValue (json , map .getClass ());
0 commit comments