public void testShouldReturnNoTargetFilesWhenSourceFileHasWrongSuffix() throws InclusionScanException { String base = "path/to/file"; File basedir = new File( "." ); Set targets = new HashSet(); targets.add( ".class" ); targets.add( ".xml" ); SuffixMapping mapping = new SuffixMapping( ".java", targets ); Set results = mapping.getTargetFiles( basedir, base + ".apt" ); assertTrue( "Returned wrong number of target files.", results.isEmpty() ); }
public void testShouldReturnSingleClassFileForSingleJavaFile() throws InclusionScanException { String base = "path/to/file"; File basedir = new File( "." ); SuffixMapping mapping = new SuffixMapping( ".java", ".class" ); Set results = mapping.getTargetFiles( basedir, base + ".java" ); assertEquals( "Returned wrong number of target files.", 1, results.size() ); assertEquals( "Target file is wrong.", new File( basedir, base + ".class" ), results.iterator().next() ); }
public void testShouldNotReturnClassFileWhenSourceFileHasWrongSuffix() throws InclusionScanException { String base = "path/to/file"; File basedir = new File( "." ); SuffixMapping mapping = new SuffixMapping( ".java", ".class" ); Set results = mapping.getTargetFiles( basedir, base + ".xml" ); assertTrue( "Returned wrong number of target files.", results.isEmpty() ); }
public void testShouldReturnOneClassFileAndOneXmlFileForSingleJavaFile() throws InclusionScanException { String base = "path/to/file"; File basedir = new File( "." ); Set targets = new HashSet(); targets.add( ".class" ); targets.add( ".xml" ); SuffixMapping mapping = new SuffixMapping( ".java", targets ); Set results = mapping.getTargetFiles( basedir, base + ".java" ); assertEquals( "Returned wrong number of target files.", 2, results.size() ); assertTrue( "Targets do not contain class target.", results.contains( new File( basedir, base + ".class" ) ) ); assertTrue( "Targets do not contain class target.", results.contains( new File( basedir, base + ".xml" ) ) ); }