testPolicyYes rerunnable +@Override in test classes

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1370044 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
skygo 2012-08-06 22:17:09 +00:00
parent 1d46686015
commit cec0299444
2 changed files with 8 additions and 14 deletions

View File

@ -81,7 +81,7 @@ public class CachedFailuresPolicyTest
policy.applyPolicy( CachedFailuresPolicy.NO, request, localFile );
}
@Test
@Test( expected = PolicyViolationException.class )
public void testPolicyYes()
throws Exception
{
@ -89,28 +89,21 @@ public class CachedFailuresPolicyTest
DownloadPolicy policy = lookupPolicy();
File localFile = getFile();
Properties request = createRequest();
// make unique name
String url = "http://a.bad.hostname.maven.org/path/to/resource"+ System.currentTimeMillis() +".txt";
request.setProperty( "url", "http://a.bad.hostname.maven.org/path/to/resource.txt" );
request.setProperty( "url", url );
// should not fail
policy.applyPolicy( CachedFailuresPolicy.YES, request, localFile );
// status Yes Not In cache
// Yes in Cache
String url = "http://a.bad.hostname.maven.org/path/to/resource.txt";
urlFailureCache.cacheFailure( url );
request.setProperty( "url", url );
try
{
policy.applyPolicy( CachedFailuresPolicy.YES, request, localFile );
fail( "Expected a PolicyViolationException." );
}
catch ( PolicyViolationException e )
{
// expected path.
}
}
}

View File

@ -368,6 +368,7 @@ public class ReleasePolicyTest
@Before
@Override
public void setUp()
throws Exception
{