mirror of https://github.com/apache/archiva.git
more use of fest assert
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1547966 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
155a90a5d2
commit
0796f03885
|
@ -156,7 +156,8 @@ public class RepositoryServletRepositoryGroupTest
|
||||||
WebResponse response = getServletUnitClient().getResponse( request );
|
WebResponse response = getServletUnitClient().getResponse( request );
|
||||||
|
|
||||||
assertResponseOK( response );
|
assertResponseOK( response );
|
||||||
assertEquals( "Expected file contents", "first", response.getText() );
|
Assertions.assertThat( response.getText() ).isEqualTo( "first" );
|
||||||
|
//assertEquals( "Expected file contents", "first", response.getText() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -177,7 +178,8 @@ public class RepositoryServletRepositoryGroupTest
|
||||||
WebResponse response = getServletUnitClient().getResponse( request );
|
WebResponse response = getServletUnitClient().getResponse( request );
|
||||||
|
|
||||||
assertResponseOK( response );
|
assertResponseOK( response );
|
||||||
assertEquals( "Expected file contents", "last", response.getText() );
|
//assertEquals( "Expected file contents", "last", response.getText() );
|
||||||
|
Assertions.assertThat( response.getText() ).isEqualTo( "last" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -265,11 +267,17 @@ public class RepositoryServletRepositoryGroupTest
|
||||||
ArchivaRepositoryMetadata metadata = MavenMetadataReader.read( returnedMetadata );
|
ArchivaRepositoryMetadata metadata = MavenMetadataReader.read( returnedMetadata );
|
||||||
|
|
||||||
assertResponseOK( response );
|
assertResponseOK( response );
|
||||||
|
/*
|
||||||
assertEquals( "Versions list size", 4, metadata.getAvailableVersions().size() );
|
assertEquals( "Versions list size", 4, metadata.getAvailableVersions().size() );
|
||||||
assertTrue( "Versions list contains version 1.0", metadata.getAvailableVersions().contains( "1.0" ) );
|
assertTrue( "Versions list contains version 1.0", metadata.getAvailableVersions().contains( "1.0" ) );
|
||||||
assertTrue( "Versions list contains version 1.5", metadata.getAvailableVersions().contains( "1.5" ) );
|
assertTrue( "Versions list contains version 1.5", metadata.getAvailableVersions().contains( "1.5" ) );
|
||||||
assertTrue( "Versions list contains version 2.0", metadata.getAvailableVersions().contains( "2.0" ) );
|
assertTrue( "Versions list contains version 2.0", metadata.getAvailableVersions().contains( "2.0" ) );
|
||||||
assertTrue( "Versions list contains version 2.5", metadata.getAvailableVersions().contains( "2.5" ) );
|
assertTrue( "Versions list contains version 2.5", metadata.getAvailableVersions().contains( "2.5" ) );
|
||||||
|
*/
|
||||||
|
|
||||||
|
Assertions.assertThat( metadata.getAvailableVersions() ).isNotNull()
|
||||||
|
.hasSize( 4 ).contains( "1.0", "1.5", "2.0", "2.5" );
|
||||||
|
|
||||||
|
|
||||||
//check if the checksum files were generated
|
//check if the checksum files were generated
|
||||||
File checksumFileSha1 = new File( repoRootFirst, resourceName + ".sha1" );
|
File checksumFileSha1 = new File( repoRootFirst, resourceName + ".sha1" );
|
||||||
|
@ -286,8 +294,11 @@ public class RepositoryServletRepositoryGroupTest
|
||||||
response = getServletUnitClient().getResource( request );
|
response = getServletUnitClient().getResource( request );
|
||||||
|
|
||||||
assertResponseOK( response );
|
assertResponseOK( response );
|
||||||
assertEquals( "add113b0d7f8c6adb92a5015a7a3701081edf998 maven-metadata-group-with-valid-repos.xml",
|
//assertEquals( "add113b0d7f8c6adb92a5015a7a3701081edf998 maven-metadata-group-with-valid-repos.xml",
|
||||||
response.getText() );
|
// response.getText() );
|
||||||
|
|
||||||
|
Assertions.assertThat( response.getText() )
|
||||||
|
.isEqualTo( "add113b0d7f8c6adb92a5015a7a3701081edf998 maven-metadata-group-with-valid-repos.xml" );
|
||||||
|
|
||||||
// request the md5 checksum of the metadata
|
// request the md5 checksum of the metadata
|
||||||
request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/"
|
request = new GetMethodWebRequest( "http://machine.com/repository/" + REPO_GROUP_WITH_VALID_REPOS + "/dummy/"
|
||||||
|
@ -295,8 +306,11 @@ public class RepositoryServletRepositoryGroupTest
|
||||||
response = getServletUnitClient().getResource( request );
|
response = getServletUnitClient().getResource( request );
|
||||||
|
|
||||||
assertResponseOK( response );
|
assertResponseOK( response );
|
||||||
assertEquals( "5b85ea4aa5f52bb76760041a52f98de8 maven-metadata-group-with-valid-repos.xml",
|
//assertEquals( "5b85ea4aa5f52bb76760041a52f98de8 maven-metadata-group-with-valid-repos.xml",
|
||||||
response.getText().trim() );
|
// response.getText().trim() );
|
||||||
|
|
||||||
|
Assertions.assertThat( response.getText() )
|
||||||
|
.isEqualTo( "5b85ea4aa5f52bb76760041a52f98de8 maven-metadata-group-with-valid-repos.xml" );
|
||||||
}
|
}
|
||||||
|
|
||||||
// MRM-901
|
// MRM-901
|
||||||
|
@ -321,18 +335,21 @@ public class RepositoryServletRepositoryGroupTest
|
||||||
WebResponse response = getServletUnitClient().getResource( request );
|
WebResponse response = getServletUnitClient().getResource( request );
|
||||||
|
|
||||||
assertResponseOK( response );
|
assertResponseOK( response );
|
||||||
Assertions.assertThat( response.getText() ).contains( "Collection" );
|
|
||||||
Assertions.assertThat( response.getText() ).contains( "dummy/dummy-artifact" );
|
Assertions.assertThat( response.getText() ).contains( "Collection" )
|
||||||
Assertions.assertThat( response.getText() ).contains( "1.0" );
|
.contains( "dummy/dummy-artifact" )
|
||||||
Assertions.assertThat( response.getText() ).contains( "2.0" );
|
.contains( "1.0" )
|
||||||
|
.contains( "2.0" );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void assertResponseMethodNotAllowed( WebResponse response )
|
protected void assertResponseMethodNotAllowed( WebResponse response )
|
||||||
{
|
{
|
||||||
assertNotNull( "Should have recieved a response", response );
|
//assertNotNull( "Should have recieved a response", response );
|
||||||
assertEquals( "Should have been an 405/Method Not Allowed response code.",
|
Assertions.assertThat( response ).isNotNull();
|
||||||
HttpServletResponse.SC_METHOD_NOT_ALLOWED, response.getResponseCode() );
|
//assertEquals( "Should have been an 405/Method Not Allowed response code.",
|
||||||
|
// HttpServletResponse.SC_METHOD_NOT_ALLOWED, response.getResponseCode() );
|
||||||
|
Assertions.assertThat( response.getResponseCode() ).isEqualTo( HttpServletResponse.SC_METHOD_NOT_ALLOWED );
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RepositoryGroupConfiguration createRepositoryGroup( String id, List<String> repositories )
|
protected RepositoryGroupConfiguration createRepositoryGroup( String id, List<String> repositories )
|
||||||
|
|
Loading…
Reference in New Issue