Skip to content

Commit caaf6af

Browse files
committed
add unittest for localization independency (issue #50)
1 parent eb50ab2 commit caaf6af

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/test/java/com/tagtraum/perf/gcviewer/exp/SimpleGcWriterTest.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import static org.junit.Assert.assertEquals;
44

55
import java.io.ByteArrayOutputStream;
6+
import java.util.Locale;
67

78
import org.junit.Before;
89
import org.junit.Test;
@@ -54,7 +55,8 @@ public void setUp() throws Exception {
5455
}
5556

5657
@Test
57-
public void export() throws Exception {
58+
public void exportLocaleDe() throws Exception {
59+
Locale.setDefault(new Locale("de", "ch"));
5860
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
5961
SimpleGcWriter writer = new SimpleGcWriter(outputStream);
6062

@@ -74,4 +76,19 @@ public void export() throws Exception {
7476
assertEquals("name of event 2", "InitialMarkGC", secondLine[0]);
7577
}
7678

79+
@Test
80+
public void exportLocaleSv() throws Exception {
81+
Locale.setDefault(new Locale("sv", "se"));
82+
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
83+
SimpleGcWriter writer = new SimpleGcWriter(outputStream);
84+
85+
writer.write(gcModel);
86+
87+
String[] lines = outputStream.toString().split(System.getProperty("line.separator"));
88+
assertEquals("line count", 2, lines.length);
89+
90+
String[] firstLine = lines[0].split(" ");
91+
assertEquals("number of parts in line 1", 3, firstLine.length);
92+
assertEquals("timestamp", "0.677000", firstLine[1]);
93+
}
7794
}

0 commit comments

Comments
 (0)