1010import java .util .Base64 ;
1111import java .util .Properties ;
1212
13- import org .junit .After ;
14- import org .junit .Before ;
1513import org .junit .Test ;
1614
1715import com .logicaldoc .util .io .FileUtil ;
18- import com .logicaldoc .util .io .IOUtil ;
1916
2017import junit .framework .Assert ;
2118
2724 */
2825public class ContextPropertiesTest {
2926
30- private ContextProperties contextProperties ;
31-
32- private File propsFile = new File ("target/testtest.properties" );
33-
34- @ Before
35- public void setUp () throws IOException {
36- IOUtil .write (this .getClass ().getResourceAsStream ("/context.properties" ), propsFile );
37- contextProperties = new ContextProperties (propsFile );
38- }
39-
40- @ After
41- public void trearDown () throws IOException {
42- FileUtil .delete (propsFile );
43- for (File backupFile : contextProperties .getBackups ()) {
44- FileUtil .delete (backupFile );
45- }
46- }
47-
4827 @ Test
4928 public void testWrite () throws IOException {
5029 File abcFile = new File ("target/abc1.properties" );
@@ -61,8 +40,9 @@ public void testWrite() throws IOException {
6140 public void testSetAndGetProperty () throws FileNotFoundException , IOException {
6241 File abcFile = new File ("target/abc.properties" );
6342 ContextProperties contextProperties = new ContextProperties (abcFile );
64-
65- // testing implicit encoding and decoding in setProperty and getPoperty (ContextProperties class)
43+
44+ // testing implicit encoding and decoding in setProperty and getPoperty
45+ // (ContextProperties class)
6646 contextProperties .setProperty ("propA" , "pippo" );
6747 contextProperties .setProperty ("propB" , """
6848 pippo
@@ -116,13 +96,13 @@ public void testSetAndGetProperty() throws FileNotFoundException, IOException {
11696 assertEquals ("pippo\n pluto\n paperino" , decodedValue1 );
11797
11898 assertEquals ("" , contextProperties .getProperty ("emptyKey" ));
119-
99+
120100 // no encoding in properties.setProperty
121101 String multiLineValue = """
122102 pippo
123103 pluto
124104 paperino""" ;
125- properties .setProperty ("propB" , multiLineValue );
126- assertEquals (multiLineValue , properties .getProperty ("propB" ));
105+ properties .setProperty ("propB" , multiLineValue );
106+ assertEquals (multiLineValue , properties .getProperty ("propB" ));
127107 }
128108}
0 commit comments