File tree Expand file tree Collapse file tree 4 files changed +50
-3
lines changed
main/java/org/hibernate/tool
test/java/org/hibernate/tool/api/xml Expand file tree Collapse file tree 4 files changed +50
-3
lines changed Original file line number Diff line number Diff line change 2
2
* Created on 17-Dec-2004
3
3
*
4
4
*/
5
- package org .hibernate .tool .internal .xml ;
5
+ package org .hibernate .tool .api .xml ;
6
6
7
7
import java .io .File ;
8
8
import java .io .IOException ;
11
11
import java .nio .file .Files ;
12
12
import java .nio .file .Paths ;
13
13
14
+ import org .hibernate .tool .internal .xml .XMLPrettyPrinterStrategyFactory ;
15
+
14
16
/**
15
17
* @author max
16
18
*
Original file line number Diff line number Diff line change 10
10
import java .util .Set ;
11
11
12
12
import org .hibernate .tool .api .export .ArtifactCollector ;
13
- import org .hibernate .tool .internal .xml .XMLPrettyPrinter ;
13
+ import org .hibernate .tool .api .xml .XMLPrettyPrinter ;
14
14
15
15
/**
16
16
* Callback class that all exporters are given to allow better feedback and
Original file line number Diff line number Diff line change @@ -30,7 +30,6 @@ private static XMLPrettyPrinterStrategy loadFromSystemProperty() {
30
30
throw new RuntimeException (e );
31
31
}
32
32
}
33
-
34
33
return null ;
35
34
}
36
35
}
Original file line number Diff line number Diff line change
1
+ package org .hibernate .tool .api .xml ;
2
+
3
+ import static org .junit .jupiter .api .Assertions .assertEquals ;
4
+
5
+ import java .io .File ;
6
+ import java .io .PrintWriter ;
7
+ import java .nio .file .Files ;
8
+
9
+ import org .junit .jupiter .api .BeforeEach ;
10
+ import org .junit .jupiter .api .Test ;
11
+ import org .junit .jupiter .api .io .TempDir ;
12
+
13
+ public class XMLPrettyPrinterTest {
14
+
15
+ private static final String XML_BEFORE = "<foo><bar>foobar</bar></foo>" ;
16
+
17
+ private static final String XML_AFTER =
18
+ "<?xml version=\" 1.0\" encoding=\" UTF-8\" standalone=\" no\" ?>\n " +
19
+ "<foo>\n " +
20
+ " <bar>foobar</bar>\n " +
21
+ "</foo>\n " ;
22
+
23
+ private static final String fileName = "foobarfile.xml" ;
24
+
25
+ @ TempDir
26
+ private File tempDir ;
27
+
28
+ private File xmlFile = null ;
29
+
30
+ @ BeforeEach
31
+ public void beforeEach () throws Exception {
32
+ xmlFile = new File (tempDir , fileName );
33
+ PrintWriter writer = new PrintWriter (xmlFile );
34
+ writer .print (XML_BEFORE );
35
+ writer .flush ();
36
+ writer .close ();
37
+ }
38
+
39
+ @ Test
40
+ public void testXmlPrettyPrintDefault () throws Exception {
41
+ XMLPrettyPrinter .prettyPrintFile (xmlFile );
42
+ String result = Files .readString (xmlFile .toPath ());
43
+ assertEquals (XML_AFTER , result );
44
+ }
45
+
46
+ }
You can’t perform that action at this time.
0 commit comments