]> source.dussan.org Git - archiva.git/commitdiff
use JUnit 4 API
authorBrett Porter <brett@apache.org>
Thu, 16 Jun 2011 07:32:22 +0000 (07:32 +0000)
committerBrett Porter <brett@apache.org>
Thu, 16 Jun 2011 07:32:22 +0000 (07:32 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1136303 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-policies/src/test/java/org/apache/maven/archiva/policies/ChecksumPolicyTest.java

index e2a3aa92e7cb6322c5ba0c6c2ac12e7953522385..215d68017fb320b51d2088ecf3ac3f71dc1d95c0 100644 (file)
@@ -19,20 +19,23 @@ package org.apache.maven.archiva.policies;
  * under the License.
  */
 
-import junit.framework.TestCase;
 import org.apache.commons.io.FileUtils;
 import org.apache.maven.archiva.common.utils.FileUtil;
+import org.junit.Rule;
 import org.junit.Test;
+import org.junit.rules.TestName;
 import org.junit.runner.RunWith;
 import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 
-import javax.inject.Inject;
-import javax.inject.Named;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
 import java.util.Properties;
+import javax.inject.Inject;
+import javax.inject.Named;
+
+import static org.junit.Assert.*;
 
 /**
  * ChecksumPolicyTest
@@ -40,18 +43,20 @@ import java.util.Properties;
  * @version $Id$
  */
 @RunWith( value = SpringJUnit4ClassRunner.class )
-@ContextConfiguration( locations = { "classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml" } )
+@ContextConfiguration( locations = {"classpath*:/META-INF/spring-context.xml", "classpath*:/spring-context.xml"} )
 public class ChecksumPolicyTest
-    extends TestCase
 {
     private static final String GOOD = "good";
 
     private static final String BAD = "bad";
 
     @Inject
-    @Named(value="postDownloadPolicy#checksum")
+    @Named( value = "postDownloadPolicy#checksum" )
     PostDownloadPolicy downloadPolicy;
 
+    @Rule
+    public TestName name = new TestName();
+
     private PostDownloadPolicy lookupPolicy()
         throws Exception
     {
@@ -334,7 +339,7 @@ public class ChecksumPolicyTest
         throws Exception
     {
         File sourceDir = getTestFile( "src/test/resources/checksums/" );
-        File destDir = getTestFile( "target/checksum-tests/" + getName() + "/" );
+        File destDir = getTestFile( "target/checksum-tests/" + name.getMethodName() + "/" );
 
         FileUtils.copyFileToDirectory( new File( sourceDir, "artifact.jar" ), destDir );