use JUnit 4 API

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1136303 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2011-06-16 07:32:22 +00:00
parent 9ae8d172b2
commit 9b41c21838
1 changed files with 12 additions and 7 deletions

View File

@ -19,20 +19,23 @@ package org.apache.maven.archiva.policies;
* under the License. * under the License.
*/ */
import junit.framework.TestCase;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.maven.archiva.common.utils.FileUtil; import org.apache.maven.archiva.common.utils.FileUtil;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.TestName;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileReader; import java.io.FileReader;
import java.util.Properties; import java.util.Properties;
import javax.inject.Inject;
import javax.inject.Named;
import static org.junit.Assert.*;
/** /**
* ChecksumPolicyTest * ChecksumPolicyTest
@ -42,7 +45,6 @@ import java.util.Properties;
@RunWith( value = SpringJUnit4ClassRunner.class ) @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 public class ChecksumPolicyTest
extends TestCase
{ {
private static final String GOOD = "good"; private static final String GOOD = "good";
@ -52,6 +54,9 @@ public class ChecksumPolicyTest
@Named( value = "postDownloadPolicy#checksum" ) @Named( value = "postDownloadPolicy#checksum" )
PostDownloadPolicy downloadPolicy; PostDownloadPolicy downloadPolicy;
@Rule
public TestName name = new TestName();
private PostDownloadPolicy lookupPolicy() private PostDownloadPolicy lookupPolicy()
throws Exception throws Exception
{ {
@ -334,7 +339,7 @@ public class ChecksumPolicyTest
throws Exception throws Exception
{ {
File sourceDir = getTestFile( "src/test/resources/checksums/" ); 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 ); FileUtils.copyFileToDirectory( new File( sourceDir, "artifact.jar" ), destDir );