Commit 69bd8b4e authored by Sonia Zorba's avatar Sonia Zorba
Browse files

Bugfix in group names parsing

parent e0a092f1
......@@ -144,7 +144,7 @@ public class GroupNameService {
currentName += c;
}
}
names.add(currentName);
names.add(currentName.replace("\\.", "."));
return names;
}
......
......@@ -11,6 +11,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.mockito.ArgumentMatchers.any;
......@@ -76,4 +77,26 @@ public class GroupNameServiceTest {
assertEquals(1, names.get("ROOT").size());
assertEquals("ROOT", names.get("ROOT").get(0));
}
@Test
public void extractGroupNamesTest() {
List<String> names = groupNameService.extractGroupNames("group1.people.name\\.surname.another\\.composite");
assertEquals(4, names.size());
assertEquals("group1", names.get(0));
assertEquals("people", names.get(1));
assertEquals("name.surname", names.get(2));
assertEquals("another.composite", names.get(3));
}
@Test
public void extractGroupNamesTestEmpty() {
assertTrue(groupNameService.extractGroupNames("").isEmpty());
}
@Test
public void extractGroupNamesTestNull() {
assertTrue(groupNameService.extractGroupNames(null).isEmpty());
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment