use of org.jabref.model.groups.ExplicitGroup in project jabref by JabRef.
the class ConvertLegacyExplicitGroupsTest method setUp.
@Before
public void setUp() throws Exception {
action = new ConvertLegacyExplicitGroups();
entry = new BibEntry();
entry.setCiteKey("Entry1");
group = new ExplicitGroup("TestGroup", GroupHierarchyType.INCLUDING, ',');
group.addLegacyEntryKey("Entry1");
}
use of org.jabref.model.groups.ExplicitGroup in project jabref by JabRef.
the class ConvertLegacyExplicitGroupsTest method performActionWritesGroupMembershipInEntryForComplexGroupTree.
@Test
public void performActionWritesGroupMembershipInEntryForComplexGroupTree() throws Exception {
GroupTreeNode root = GroupTreeNode.fromGroup(new AllEntriesGroup(""));
root.addSubgroup(new ExplicitGroup("TestGroup2", GroupHierarchyType.INCLUDING, ','));
root.addSubgroup(group);
ParserResult parserResult = generateParserResult(root);
action.performAction(parserResult);
assertEquals(Optional.of("TestGroup"), entry.getField("groups"));
}
use of org.jabref.model.groups.ExplicitGroup in project jabref by JabRef.
the class GroupsParserTest method testImportSubGroups.
@Test
public void testImportSubGroups() throws ParseException {
List<String> orderedData = Arrays.asList("0 AllEntriesGroup:", "1 ExplicitGroup:1;0;", "2 ExplicitGroup:2;0;", "0 ExplicitGroup:3;0;");
//Create group hierarchy:
// Level 0 Name: All entries
// Level 1 Name: 1
// Level 2 Name: 2
// Level 1 Name: 3
GroupTreeNode rootNode = new GroupTreeNode(new ExplicitGroup("All entries", GroupHierarchyType.INDEPENDENT, ','));
AbstractGroup firstSubGrpLvl1 = new ExplicitGroup("1", GroupHierarchyType.INDEPENDENT, ',');
rootNode.addSubgroup(firstSubGrpLvl1);
AbstractGroup subLvl2 = new ExplicitGroup("2", GroupHierarchyType.INDEPENDENT, ',');
rootNode.getFirstChild().ifPresent(c -> c.addSubgroup(subLvl2));
AbstractGroup thirdSubGrpLvl1 = new ExplicitGroup("3", GroupHierarchyType.INDEPENDENT, ',');
rootNode.addSubgroup(thirdSubGrpLvl1);
GroupTreeNode parsedNode = GroupsParser.importGroups(orderedData, ',');
assertEquals(rootNode.getChildren(), parsedNode.getChildren());
}
use of org.jabref.model.groups.ExplicitGroup in project jabref by JabRef.
the class GroupsParserTest method fromStringParsesExplicitGroupWithIconAndDesrcitpion.
@Test
public void fromStringParsesExplicitGroupWithIconAndDesrcitpion() throws Exception {
ExplicitGroup expected = new ExplicitGroup("myExplicitGroup", GroupHierarchyType.INDEPENDENT, ',');
expected.setIconCode("test icon");
expected.setExpanded(true);
expected.setColor(Color.ALICEBLUE);
expected.setDescription("test description");
AbstractGroup parsed = GroupsParser.fromString("StaticGroup:myExplicitGroup;0;1;0xf0f8ffff;test icon;test description;", ',');
assertEquals(expected, parsed);
}
use of org.jabref.model.groups.ExplicitGroup in project jabref by JabRef.
the class GroupsParserTest method fromStringParsesExplicitGroupWithEscapedCharacterInName.
@Test
public // For https://github.com/JabRef/jabref/issues/1681
void fromStringParsesExplicitGroupWithEscapedCharacterInName() throws Exception {
ExplicitGroup expected = new ExplicitGroup("B{\\\"{o}}hmer", GroupHierarchyType.INDEPENDENT, ',');
AbstractGroup parsed = GroupsParser.fromString("ExplicitGroup:B{\\\\\"{o}}hmer;0;", ',');
assertEquals(expected, parsed);
}
Aggregations