@Test
public void testCsvToSet() {

    Set<String> propValue = null;
    // empty csv
    propValue = OAuthAuthorityUtils.csvToSet(null, ",");
    assertNull(propValue);
    propValue = OAuthAuthorityUtils.csvToSet("", ",");
    assertNull(propValue);
    // empty delimiter
    propValue = OAuthAuthorityUtils.csvToSet("csv_1,csv_2", null);
    assertEquals(propValue, new HashSet<>(Arrays.asList("csv_1,csv_2")));
    propValue = OAuthAuthorityUtils.csvToSet("csv_1,csv_2", "");
    assertEquals(propValue, new HashSet<>(Arrays.asList("csv_1,csv_2")));
    // string delimiter
    propValue = OAuthAuthorityUtils.csvToSet("csv_1,csv_2", ",");
    assertEquals(propValue, new HashSet<>(Arrays.asList("csv_1", "csv_2")));
    propValue = OAuthAuthorityUtils.csvToSet("csv_1,csv_2", "_");
    assertEquals(propValue, new HashSet<>(Arrays.asList("csv", "1,csv", "2")));
    propValue = OAuthAuthorityUtils.csvToSet("csv_1,csv_2,", ",");
    assertEquals(propValue, new HashSet<>(Arrays.asList("csv_1", "csv_2")));
    // regex delimiter
    propValue = OAuthAuthorityUtils.csvToSet("csv_1,csv_2", "\\d");
    assertEquals(propValue, new HashSet<>(Arrays.asList("csv_", ",csv_")));
    propValue = OAuthAuthorityUtils.csvToSet("csv_1,csv_2,csv_3", "\\d");
    assertEquals(propValue, new HashSet<>(Arrays.asList("csv_", ",csv_")));
}