Skip to content
This repository has been archived by the owner on Mar 29, 2019. It is now read-only.

Commit

Permalink
Use String.format to generate expected output
Browse files Browse the repository at this point in the history
IN the CumulativeHistory.toString, String.format is used to generate the
output.  However, since a locale isn't specified, in the test (which
expected a hard coded string), number formatting can differ).  By using
String.format in the test as well, this should generate locale agnostic
results.

BATCHADM-217
  • Loading branch information
mminella committed Jul 17, 2015
1 parent 207a5a2 commit d8fa8ff
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@
*/
package org.springframework.batch.admin.history;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;

import org.junit.Test;

import org.springframework.batch.admin.domain.CumulativeHistory;

public class CumulativeHistoryTests {
Expand All @@ -35,9 +36,10 @@ public void testString() {
history.append(1);
history.append(2);
history.append(3);
assertEquals(
"[N=3, min=1.000000, max=3.000000, mean=2.000000, sigma=0.816497]",
history.toString());

String output = String.format("[N=%d, min=%f, max=%f, mean=%f, sigma=%f]", 3, 1.0f, 3.0f, 2.0f, 0.816497);

assertEquals(output, history.toString());
}

@Test
Expand Down

0 comments on commit d8fa8ff

Please sign in to comment.