Search in sources :

Example 1 with ProBPreference

use of de.prob.animator.domainobjects.ProBPreference in project prob2 by bendisposto.

the class GetPreferencesCommandTest method testProcessResults.

@Test
public void testProcessResults() {
    @SuppressWarnings("unchecked") ISimplifiedROMap<String, PrologTerm> map = mock(ISimplifiedROMap.class);
    when(map.get("Prefs")).thenReturn(new ListPrologTerm(new CompoundPrologTerm("preference", new CompoundPrologTerm("tinker"), new CompoundPrologTerm("tailor"), new CompoundPrologTerm("soldier"), new CompoundPrologTerm("sailor"), new CompoundPrologTerm("foo")), new CompoundPrologTerm("preference", new CompoundPrologTerm("richman"), new CompoundPrologTerm("poorman"), new CompoundPrologTerm("beggarman"), new CompoundPrologTerm("thief"), new CompoundPrologTerm("bar"))));
    GetDefaultPreferencesCommand command = new GetDefaultPreferencesCommand();
    command.processResult(map);
    List<ProBPreference> prefs = command.getPreferences();
    assertEquals(prefs.size(), 2);
    ProBPreference pref1 = prefs.get(0);
    assertEquals(pref1.name, "tinker");
    assertEquals(pref1.type.toString(), "tailor");
    assertEquals(pref1.description, "soldier");
    assertEquals(pref1.category, "sailor");
    assertEquals(pref1.defaultValue, "foo");
    ProBPreference pref2 = prefs.get(1);
    assertEquals(pref2.name, "richman");
    assertEquals(pref2.type.toString(), "poorman");
    assertEquals(pref2.description, "beggarman");
    assertEquals(pref2.category, "thief");
    assertEquals(pref2.defaultValue, "bar");
}
Also used : ListPrologTerm(de.prob.prolog.term.ListPrologTerm) ProBPreference(de.prob.animator.domainobjects.ProBPreference) CompoundPrologTerm(de.prob.prolog.term.CompoundPrologTerm) CompoundPrologTerm(de.prob.prolog.term.CompoundPrologTerm) ListPrologTerm(de.prob.prolog.term.ListPrologTerm) PrologTerm(de.prob.prolog.term.PrologTerm) Test(org.junit.Test)

Aggregations

ProBPreference (de.prob.animator.domainobjects.ProBPreference)1 CompoundPrologTerm (de.prob.prolog.term.CompoundPrologTerm)1 ListPrologTerm (de.prob.prolog.term.ListPrologTerm)1 PrologTerm (de.prob.prolog.term.PrologTerm)1 Test (org.junit.Test)1