AssetAutoTaggerSystemConfigurationModelListener implements ConfigurationModelListener { @Override public void onBeforeSave(String pid, Dictionary<String, Object> properties) throws ConfigurationModelListenerException { int maximumNumberOfTagsPerAsset = GetterUtil.getInteger( properties.get("maximumNumberOfTagsPerAsset")); if (maximumNumberOfTagsPerAsset < 0) { throw new ConfigurationModelListenerException( ResourceBundleUtil.getString( _getResourceBundle(), "maximum-number-of-tags-per-asset-cannot-be-negative"), AssetAutoTaggerSystemConfiguration.class, getClass(), properties); } }  @Override void onBeforeSave(String pid, Dictionary<String, Object> properties);  }
@Test(expected = ConfigurationModelListenerException.class) public void testMaximumNumberOfTagsPerAssetNegative() throws ConfigurationModelListenerException { Dictionary<String, Object> properties = new HashMapDictionary<>(); properties.put("maximumNumberOfTagsPerAsset", -1); _assetAutoTaggerSystemConfigurationModelListener.onBeforeSave( RandomTestUtil.randomString(), properties); }