Skip to content

Commit 9111b94

Browse files
committed
Fixed Unit test.
1 parent 0164db6 commit 9111b94

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/test/java/org/apache/maven/archiver/MavenArchiverTest.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public void testMultiClassPath()
182182
Model model = new Model();
183183
model.setArtifactId( "dummy" );
184184

185-
MavenProject project = new MavenProject( model)
185+
MavenProject project = new MavenProject( model )
186186
{
187187
public List<String> getRuntimeClasspathElements()
188188
{
@@ -234,22 +234,27 @@ public void testRecreation()
234234
FileUtils.deleteDirectory( "target/maven-archiver" );
235235
archiver.createArchive( session, project, config );
236236
assertTrue( jarFile.exists() );
237-
jarFile.setLastModified( System.currentTimeMillis() - 60000L );
237+
238+
long history = System.currentTimeMillis() - 60000L;
239+
System.out.println( "History: " + history );
240+
jarFile.setLastModified( history );
238241
long time = jarFile.lastModified();
242+
System.out.println( "Time:" + time );
239243

240244
List<File> files = FileUtils.getFiles( new File( "target/maven-archiver" ), "**/**", null, true );
241-
for ( Object file : files )
245+
for ( File file : files )
242246
{
243-
File f = (File) file;
244-
f.setLastModified( time );
247+
assertTrue( file.setLastModified( time ) );
245248
}
246249

247250
archiver.createArchive( session, project, config );
248-
assertEquals( jarFile.lastModified(), time );
251+
// Is the assumption correct that the jar file itself
252+
// should have the same last modified time as the files itself ?
253+
assertEquals( "History " + history + " time:" + time , jarFile.lastModified(), time );
249254

250255
config.setForced( true );
251256
archiver.createArchive( session, project, config );
252-
//I'm not sure if it could only be greater than time or if it is sufficient to be greater or equal..
257+
// I'm not sure if it could only be greater than time or if it is sufficient to be greater or equal..
253258
assertTrue( jarFile.lastModified() >= time );
254259
}
255260

@@ -420,7 +425,7 @@ public void testCarriageReturnInManifestEntry()
420425
config.getManifest().setAddDefaultImplementationEntries( true );
421426
config.addManifestEntry( "Description", project.getDescription() );
422427
// config.addManifestEntry( "EntryWithTab", " foo tab " + ( '\u0009' ) + ( '\u0009' ) // + " bar tab" + ( //
423-
// '\u0009' // ) );
428+
// '\u0009' // ) );
424429
archiver.createArchive( session, project, config );
425430
assertTrue( jarFile.exists() );
426431

@@ -748,7 +753,7 @@ public void shouldCreateArchiveCustomerLayoutSimple()
748753
config.getManifest().setAddClasspath( true );
749754
config.getManifest().setClasspathPrefix( "lib" );
750755
config.getManifest().setClasspathLayoutType( ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_CUSTOM );
751-
config.getManifest().setCustomClasspathLayout( MavenArchiver.SIMPLE_LAYOUT);
756+
config.getManifest().setCustomClasspathLayout( MavenArchiver.SIMPLE_LAYOUT );
752757

753758
archiver.createArchive( session, project, config );
754759
assertTrue( jarFile.exists() );
@@ -787,7 +792,7 @@ public void shouldCreateArchiveCustomLayoutSimpleNonUnique()
787792
config.getManifest().setAddClasspath( true );
788793
config.getManifest().setClasspathPrefix( "lib" );
789794
config.getManifest().setClasspathLayoutType( ManifestConfiguration.CLASSPATH_LAYOUT_TYPE_CUSTOM );
790-
config.getManifest().setCustomClasspathLayout( MavenArchiver.SIMPLE_LAYOUT_NONUNIQUE);
795+
config.getManifest().setCustomClasspathLayout( MavenArchiver.SIMPLE_LAYOUT_NONUNIQUE );
791796

792797
archiver.createArchive( session, project, config );
793798
assertTrue( jarFile.exists() );
@@ -1338,7 +1343,7 @@ private File getClasspathFile( String file )
13381343
URL resource = Thread.currentThread().getContextClassLoader().getResource( file );
13391344
if ( resource == null )
13401345
{
1341-
fail("Cannot retrieve java.net.URL for file: " + file + " on the current test classpath." );
1346+
fail( "Cannot retrieve java.net.URL for file: " + file + " on the current test classpath." );
13421347
}
13431348

13441349
URI uri = new File( resource.getPath() ).toURI().normalize();

0 commit comments

Comments
 (0)