Util implements AccessControlConstants { static int getImportBehavior(AuthorizationConfiguration config) { String importBehaviorStr = config.getParameters().getConfigValue(ProtectedItemImporter.PARAM_IMPORT_BEHAVIOR, ImportBehavior.NAME_ABORT); return ImportBehavior.valueFromString(importBehaviorStr); } private  Util();   }
@Test public void testGetImportBehaviorDefault() { AuthorizationConfiguration config = when(mock(AuthorizationConfiguration.class).getParameters()).thenReturn(ConfigurationParameters.EMPTY).getMock(); assertSame(ImportBehavior.ABORT, Util.getImportBehavior(config)); }
@Test public void testGetImportBehaviorInvalid() { AuthorizationConfiguration config = when(mock(AuthorizationConfiguration.class).getParameters()).thenReturn(ConfigurationParameters.of(ProtectedItemImporter.PARAM_IMPORT_BEHAVIOR, "invalid")).getMock(); assertSame(ImportBehavior.ABORT, Util.getImportBehavior(config)); }
@Test public void testGetImportBehavior() { AuthorizationConfiguration config = when(mock(AuthorizationConfiguration.class).getParameters()).thenReturn(ConfigurationParameters.of(ProtectedItemImporter.PARAM_IMPORT_BEHAVIOR, ImportBehavior.NAME_BESTEFFORT)).getMock(); assertSame(ImportBehavior.BESTEFFORT, Util.getImportBehavior(config)); }