MessageFileFilter implements FileFilter { boolean isMatchWithRegExp(final File file) { return file.getName().matches(FILE_NAME_EXP); }  @Override boolean accept(final File file);  }
@Test public void testIsMatchWithRegExpShouldReturnFalseWhenSuffixDoesNotMatch() { String fileName = "20130701132107.0025asd.txt"; given(file.getName()).willReturn(fileName); boolean result = underTest.isMatchWithRegExp(file); assertFalse(result); }
@Test public void testIsMatchWithRegExpShouldReturnFalseWhenTimeStampDoesNotMatch() { String fileName = "2013070113210766.0025req.txt"; given(file.getName()).willReturn(fileName); boolean result = underTest.isMatchWithRegExp(file); assertFalse(result); }
@Test public void testIsMatchWithRegExpShouldReturnFalseWhenIDDoesNotMatch() { String fileName = "20130701132107.00325req.txt"; given(file.getName()).willReturn(fileName); boolean result = underTest.isMatchWithRegExp(file); assertFalse(result); }
@Test public void testIsMatchWithRegExpShouldReturnFalseWhenExtensionDoesNotMatch() { String fileName = "20130701132107.0025req.csv"; given(file.getName()).willReturn(fileName); boolean result = underTest.isMatchWithRegExp(file); assertFalse(result); }
@Test public void testIsMatchWithRegExpShouldReturnFalseWhenDotIsMissing() { String fileName = "201307011321070025req.csv"; given(file.getName()).willReturn(fileName); boolean result = underTest.isMatchWithRegExp(file); assertFalse(result); }
@Test public void testIsMatchWithRegExpShouldReturnTrueWhenNameDoesMatch() { String fileName = "20130701132107.0025resp.txt"; given(file.getName()).willReturn(fileName); boolean result = underTest.isMatchWithRegExp(file); assertTrue(result); }