### Question:
BasicAttachmentProvider implements AttachmentProvider { protected static String getFileExtension( final String filename ) { String fileExt = "bin"; final int dot = filename.lastIndexOf('.'); if( dot >= 0 && dot < filename.length()-1 ) { fileExt = mangleName( filename.substring( dot+1 ) ); } return fileExt; }  @Override void initialize( final Engine engine, final Properties properties ); @Override void putAttachmentData( final Attachment att, final InputStream data ); @Override String getProviderInfo(); @Override InputStream getAttachmentData( final Attachment att ); @Override List< Attachment > listAttachments( final Page page ); @Override Collection< Attachment > findAttachments( final QueryItem[] query ); @Override List< Attachment > listAllChanged( final Date timestamp ); @Override Attachment getAttachmentInfo( final Page page, final String name, int version ); @Override List< Attachment > getVersionHistory( final Attachment att ); @Override void deleteVersion( final Attachment att ); @Override void deleteAttachment( final Attachment att ); @Override void moveAttachmentsForPage( final String oldParent, final String newParent ); static final String PROP_DISABLECACHE; static final String PROPERTY_FILE; static final String DIR_EXTENSION; static final String ATTDIR_EXTENSION; }### Answer:
@Test public void testExtension() { final String s = "test.png"; Assertions.assertEquals( "png", BasicAttachmentProvider.getFileExtension(s) ); }
@Test public void testExtension2() { final String s = ".foo"; Assertions.assertEquals( "foo", BasicAttachmentProvider.getFileExtension(s) ); }
@Test public void testExtension3() { final String s = "test.png.3"; Assertions.assertEquals( "3", BasicAttachmentProvider.getFileExtension(s) ); }
@Test public void testExtension4() { final String s = "testpng"; Assertions.assertEquals( "bin", BasicAttachmentProvider.getFileExtension(s) ); }
@Test public void testExtension5() { final String s = "test."; Assertions.assertEquals( "bin", BasicAttachmentProvider.getFileExtension(s) ); }
@Test public void testExtension6() { final String s = "test.a"; Assertions.assertEquals( "a", BasicAttachmentProvider.getFileExtension(s) ); }