diff options
author | Olivier Lamy <olamy@apache.org> | 2014-03-24 01:36:57 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2014-03-24 01:36:57 +0000 |
commit | ed0db11f65e5c67c68c8b5246f7c13c55f249502 (patch) | |
tree | 7c61e42660ffe66e8dc3bcd9d7f992daaa31e8c0 /archiva-modules/metadata/metadata-repository-api/src | |
parent | 72ddf2322fd1e95a3b18ef541fdee8a15437a4a3 (diff) | |
download | archiva-ed0db11f65e5c67c68c8b5246f7c13c55f249502.tar.gz archiva-ed0db11f65e5c67c68c8b5246f7c13c55f249502.zip |
prevent ClassCastException as now return a Collection rather than a List
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1580693 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/metadata/metadata-repository-api/src')
-rw-r--r-- | archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java index c33c8d676..20f8f9664 100644 --- a/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java +++ b/archiva-modules/metadata/metadata-repository-api/src/test/java/org/apache/archiva/metadata/repository/AbstractMetadataRepositoryTest.java @@ -270,7 +270,7 @@ public abstract class AbstractMetadataRepositoryTest MailingList mailingList = new MailingList(); mailingList.setName( "Foo List" ); mailingList.setOtherArchives( Arrays.asList( "other archive" ) ); - metadata.setMailingLists( Arrays.asList( mailingList ) ); + metadata.setMailingLists( Arrays.asList( mailingList ) ); Scm scm = new Scm(); scm.setConnection( "connection" ); @@ -321,7 +321,8 @@ public abstract class AbstractMetadataRepositoryTest mailingList = metadata.getMailingLists().get( 0 ); assertEquals( "Foo List", mailingList.getName() ); //assertEquals( Collections.singletonList( "other archive" ), mailingList.getOtherArchives() ); - Assertions.assertThat( mailingList.getOtherArchives() ).isNotNull().isNotEmpty().hasSize( 1 ).contains( "other archive" ); + Assertions.assertThat( mailingList.getOtherArchives() ).isNotNull().isNotEmpty().hasSize( 1 ).contains( + "other archive" ); assertEquals( "connection", metadata.getScm().getConnection() ); assertEquals( "dev conn", metadata.getScm().getDeveloperConnection() ); @@ -1010,13 +1011,13 @@ public abstract class AbstractMetadataRepositoryTest // test it restricts to the appropriate repository assertEquals( Collections.singletonList( artifact ), - repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ); - assertEquals( Collections.singletonList( secondArtifact ), - repository.getArtifactsByChecksum( OTHER_REPO_ID, TEST_SHA1 ) ); + new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ) ); + assertEquals( Collections.singletonList( secondArtifact ), new ArrayList<ArtifactMetadata>( + repository.getArtifactsByChecksum( OTHER_REPO_ID, TEST_SHA1 ) ) ); assertEquals( Collections.singletonList( artifact ), - repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ); + new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ) ); assertEquals( Collections.singletonList( secondArtifact ), - repository.getArtifactsByChecksum( OTHER_REPO_ID, TEST_MD5 ) ); + new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( OTHER_REPO_ID, TEST_MD5 ) ) ); } @Test @@ -1103,7 +1104,7 @@ public abstract class AbstractMetadataRepositoryTest repository.save(); assertEquals( Collections.singletonList( artifact ), - repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ); + new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ) ); } @Test @@ -1115,7 +1116,7 @@ public abstract class AbstractMetadataRepositoryTest repository.save(); assertEquals( Collections.singletonList( artifact ), - repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ); + new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ) ); } @Test @@ -1129,9 +1130,9 @@ public abstract class AbstractMetadataRepositoryTest repository.save(); assertEquals( Collections.singletonList( artifact ), - repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ); + new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_SHA1 ) ) ); assertEquals( Collections.singletonList( artifact ), - repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ); + new ArrayList<ArtifactMetadata>( repository.getArtifactsByChecksum( TEST_REPO_ID, TEST_MD5 ) ) ); } @Test @@ -1164,8 +1165,9 @@ public abstract class AbstractMetadataRepositoryTest ArtifactMetadata artifact = createArtifact(); repository.updateArtifact( TEST_REPO_ID, TEST_NAMESPACE, TEST_PROJECT, TEST_PROJECT_VERSION, artifact ); - Collection<ArtifactMetadata> artifactsByChecksum = repository.getArtifactsByChecksum( TEST_REPO_ID, "not checksum" ); - assertEquals( Collections.<ArtifactMetadata>emptyList(), artifactsByChecksum ); + Collection<ArtifactMetadata> artifactsByChecksum = + repository.getArtifactsByChecksum( TEST_REPO_ID, "not checksum" ); + Assertions.assertThat( artifactsByChecksum ).isNotNull().isEmpty(); } |