### Question:
SnmpThresholder implements ServiceThresholder { protected String stripRrdExtension(String fileName) { if (!fileName.endsWith(RrdUtils.getExtension())) { log().info("stripRrdExtension: File '" + fileName + "' does not end with the RRD extension '" + RrdUtils.getExtension() + "'."); return null; } return fileName.substring(0, fileName.lastIndexOf(RrdUtils.getExtension())); }  String serviceName(); void initialize(Map<?,?> parameters); void reinitialize(); void release(); void initialize(ThresholdNetworkInterface netIface, Map<?,?> parms); void release(ThresholdNetworkInterface iface); int check(ThresholdNetworkInterface netIface, EventProxy eproxy, Map<?,?> parms); ThresholdsDao getThresholdsDao(); void setThresholdsDao(ThresholdsDao thresholdsDao); IfInfoGetter getIfInfoGetter(); void setIfInfoGetter(IfInfoGetter ifInfoGetter);  }### Answer:
@SuppressWarnings("deprecation") @Test public void testStripRrdExtensionWithValidExtension() throws Exception { String strippedName = m_snmpThresholder.stripRrdExtension("foo" + RrdUtils.getExtension()); assertNotNull("stripped file name should not be null", strippedName); assertEquals("stripped file name", "foo", strippedName); }
@SuppressWarnings("deprecation") @Test public void testStripRrdExtensionWithNoExtension() throws Exception { String strippedName = m_snmpThresholder.stripRrdExtension("foo"); assertNull("stripped file name should be null, but was: " + strippedName, strippedName); }
@SuppressWarnings("deprecation") @Test public void testStripRrdExtensionWithValidExtensionTwice() throws Exception { String strippedName = m_snmpThresholder.stripRrdExtension("foo" + RrdUtils.getExtension() + RrdUtils.getExtension()); assertNotNull("stripped file name should not be null", strippedName); assertEquals("stripped file name", "foo" + RrdUtils.getExtension(), strippedName); }
@SuppressWarnings("deprecation") @Test public void testStripRrdExtensionWithValidExtensionNotAtEnd() throws Exception { String strippedName = m_snmpThresholder.stripRrdExtension("foo" + RrdUtils.getExtension() + ".bar"); assertNull("stripped file name should be null, but was: " + strippedName, strippedName); }