### Question:
FileSystemProvider extends AbstractFileProvider { @Override public void putPageText( final Page page, final String text ) throws ProviderException { try { super.putPageText( page, text ); putPageProperties( page ); } catch( final IOException e ) { log.error( "Saving failed" ); } }  @Override void putPageText( final Page page, final String text ); @Override Page getPageInfo( final String page, final int version ); @Override void deletePage( final String pageName); @Override void movePage( final String from, final String to ); static final String PROP_EXT; }### Answer:
@Test public void testScandinavianLetters() throws Exception { final WikiPage page = new WikiPage(m_engine, "\u00c5\u00e4Test"); m_provider.putPageText( page, "test" ); final File resultfile = new File( props.getProperty( FileSystemProvider.PROP_PAGEDIR ) , "%C5%E4Test.txt" ); Assertions.assertTrue( resultfile.exists(), "No such file" ); final String contents = FileUtil.readContents( new FileInputStream(resultfile), "ISO-8859-1" ); Assertions.assertEquals( contents, "test", "Wrong contents" ); }
@Test public void testScandinavianLettersUTF8() throws Exception { final WikiPage page = new WikiPage(m_engine, "\u00c5\u00e4Test"); m_providerUTF8.putPageText( page, "test\u00d6" ); final File resultfile = new File( props.getProperty( FileSystemProvider.PROP_PAGEDIR ) , "%C3%85%C3%A4Test.txt" ); Assertions.assertTrue( resultfile.exists(), "No such file" ); final String contents = FileUtil.readContents( new FileInputStream(resultfile), "UTF-8" ); Assertions.assertEquals( contents, "test\u00d6", "Wrong contents" ); }
@Test public void testSlashesInPageNamesUTF8() throws Exception { final WikiPage page = new WikiPage(m_engine, "Test/Foobar"); m_providerUTF8.putPageText( page, "test" ); final File resultfile = new File( props.getProperty( FileSystemProvider.PROP_PAGEDIR ) , "Test%2FFoobar.txt" ); Assertions.assertTrue( resultfile.exists(), "No such file" ); final String contents = FileUtil.readContents( new FileInputStream(resultfile), "UTF-8" ); Assertions.assertEquals( contents, "test", "Wrong contents" ); }
@Test public void testSlashesInPageNames() throws Exception { final WikiPage page = new WikiPage(m_engine, "Test/Foobar"); m_provider.putPageText( page, "test" ); final File resultfile = new File( props.getProperty( FileSystemProvider.PROP_PAGEDIR ) , "Test%2FFoobar.txt" ); Assertions.assertTrue( resultfile.exists(), "No such file" ); final String contents = FileUtil.readContents( new FileInputStream(resultfile), "ISO-8859-1" ); Assertions.assertEquals( contents, "test", "Wrong contents" ); }
@Test public void testDotsInBeginning() throws Exception { final WikiPage page = new WikiPage(m_engine, ".Test"); m_provider.putPageText( page, "test" ); final File resultfile = new File( props.getProperty( FileSystemProvider.PROP_PAGEDIR ) , "%2ETest.txt" ); Assertions.assertTrue( resultfile.exists(), "No such file" ); final String contents = FileUtil.readContents( new FileInputStream(resultfile), "ISO-8859-1" ); Assertions.assertEquals( contents, "test", "Wrong contents" ); }