Commit 5e97ce76 authored by Manoel Campos's avatar Manoel Campos

Inclusion of missing dependency for org.apache.commons.commons-math3.

Fixed test failures for LogTest class due to hardcoded decimal separator. 
Some test cases was not passing due to decimal separator was hardcoded as comma, 
instead of getting the default decimal separator configured on the system.
parent 7345fe46
......@@ -65,9 +65,16 @@
</configuration>
</plugin>
</plugins>
</build>
<reporting>
</build>
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.4.1</version>
<type>jar</type>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
......
......@@ -12,7 +12,7 @@ import java.io.IOException;
import java.io.OutputStream;
/**
* The Log class used for performing loggin of the simulation process. It provides the ability to
* The Log class used for performing logging of the simulation process. It provides the ability to
* substitute the output stream by any OutputStream subclass.
*
* @author Anton Beloglazov
......
......@@ -14,6 +14,8 @@ import static org.junit.Assert.assertTrue;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.text.DecimalFormatSymbols;
import java.util.Locale;
import org.junit.Before;
import org.junit.Test;
......@@ -26,6 +28,8 @@ public class LogTest {
private static final ByteArrayOutputStream OUTPUT = new ByteArrayOutputStream();
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
private static final DecimalFormatSymbols dfs =
DecimalFormatSymbols.getInstance(Locale.getDefault(Locale.Category.FORMAT));
@Before
public void setUp() throws Exception {
......@@ -85,12 +89,13 @@ public class LogTest {
OUTPUT.reset();
Log.format("%.2f", 123.01);
assertEquals("123.01", OUTPUT.toString());
assertEquals("123"+dfs.getDecimalSeparator()+"01", OUTPUT.toString());
OUTPUT.reset();
}
@Test
public void testFormatLine() throws IOException {
OUTPUT.reset();
Log.formatLine("test %s test", "test");
assertEquals("test test test" + LINE_SEPARATOR, OUTPUT.toString());
OUTPUT.reset();
......@@ -104,12 +109,13 @@ public class LogTest {
OUTPUT.reset();
Log.formatLine("%.2f", 123.01);
assertEquals("123.01" + LINE_SEPARATOR, OUTPUT.toString());
assertEquals("123"+dfs.getDecimalSeparator()+"01" + LINE_SEPARATOR, OUTPUT.toString());
OUTPUT.reset();
}
@Test
public void testDisable() throws IOException {
OUTPUT.reset();
assertFalse(Log.isDisabled());
Log.print("test test");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment