Commit 1159bc39 authored by Matthew Dawson's avatar Matthew Dawson
Browse files

In the CheckerRunnerResult tests, use a LinkedHashMap to ensure ordering.

There is no reason to use a HashMap in the test, which makes checking the
result harder.  So, instead just use a LinkedHashMap so the result is always
the same.
parent ddc2bb22
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

import java.util.HashMap;
import java.util.LinkedHashMap;

import static org.junit.Assert.*;

@@ -33,14 +33,10 @@ public class CheckerRunnerResultTest {
    public void TestGenerateMatlabVariableDeclarations() {
        CheckerRunnerResult instance = new CheckerRunnerResult();

        instance.SampleValues = new HashMap<String, String>();
        instance.SampleValues = new LinkedHashMap<String, String>();
        instance.SampleValues.put("x", "5.0");
        instance.SampleValues.put("z", "STRCONST");

        try {
        assertEquals("x = 5.0;\nz = STRCONST;\n", instance.GenerateMatlabVariableDeclarations());
        } catch(AssertionError e) {
            assertEquals("z = STRCONST;\nx = 5.0;\n", instance.GenerateMatlabVariableDeclarations());
        }
    }
}