コード例 #1
0
 public void shouldFindArtifact() {
   when(artifactFactory.createArtifact(
           coord.getGroupId(), coord.getArtifactId(), coord.getVersion(), "", coord.getFileType()))
       .thenReturn(goodArtifact);
   try {
     assertSame(locator.getAbsolutePathToArtifact(coord), A_PATH);
   } catch (Exception e) {
     fail("Should not have thrown an exception.");
   }
 }
コード例 #2
0
 public void shouldThrowExceptionForInvalidFileType() {
   String badFileType = "jstestdriver-invalid-artifact";
   when(artifactFactory.createArtifact(
           coord.getGroupId(), coord.getArtifactId(), coord.getVersion(), "", badFileType))
       .thenReturn(badArtifact);
   when(coord.getFileType()).thenReturn(badFileType);
   try {
     locator.getAbsolutePathToArtifact(coord);
     fail("Should have thrown an exception for invalid artifactId");
   } catch (ArtifactNotFoundException ignored) {
   }
 }
コード例 #3
0
 public void shouldThrowExceptionForInvalidGroupId() {
   String badGroupId = "com.google.jstestdriver.some.invalid.group";
   when(artifactFactory.createArtifact(
           badGroupId, coord.getArtifactId(), coord.getVersion(), "", coord.getFileType()))
       .thenReturn(badArtifact);
   when(coord.getGroupId()).thenReturn(badGroupId);
   try {
     locator.getAbsolutePathToArtifact(coord);
     fail("Should have thrown an exception for invalid groupId");
   } catch (ArtifactNotFoundException ignored) {
   }
 }