package net.sf.jabref.logic.groups;

import net.sf.jabref.model.entry.BibEntry;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class SearchGroupTest {

    @Test
    public void testContains() {
        SearchGroup group = new SearchGroup("myExplicitGroup", "review",
                true, true, GroupHierarchyType.INDEPENDENT);
        assertEquals("SearchGroup:myExplicitGroup;0;review;1;1;", group.toString());

        BibEntry entry = new BibEntry();
        assertFalse(group.contains(entry));

        entry.addKeyword("review");
        assertTrue(group.contains(entry));
    }

    @Test
    public void testToStringSimple() {
        SearchGroup group = new SearchGroup("myExplicitGroup", "author=harrer",
                true, true, GroupHierarchyType.INDEPENDENT);
        assertEquals("SearchGroup:myExplicitGroup;0;author=harrer;1;1;", group.toString());
    }

    @Test
    public void testToStringComplex() {
        SearchGroup group = new SearchGroup("myExplicitGroup", "author=\"harrer\"", true, false,
                GroupHierarchyType.INCLUDING);
        assertEquals("SearchGroup:myExplicitGroup;2;author=\"harrer\";1;0;", group.toString());
    }

}
@@ -55,30 +55,130 @@
 ref.
-model.entry.BibEntry;%0A
+Globals;%0Aimport net.sf.jabref.JabRefPreferences;%0Aimport net.sf.jabref.model.entry.BibEntry;%0A%0Aimport org.junit.BeforeClass;
 %0Aimp
@@ -363,16 +363,130 @@
 Test %7B%0A%0A
+    @BeforeClass%0A    public static void setUp() %7B%0A        Globals.prefs = JabRefPreferences.getInstance();%0A    %7D%0A%0A
     @Tes

Make sure the preferences are loaded in SearchGroupTest