Skip to content

Commit 26656e3

Browse files
committed
EVCSFileNotFound exception updated
1 parent e3f2794 commit 26656e3

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

src/main/java/org/scm4j/vcs/api/exceptions/EVCSFileNotFound.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ public class EVCSFileNotFound extends EVCSException {
44

55
private static final long serialVersionUID = 1L;
66

7-
public EVCSFileNotFound(Exception e) {
8-
super(e);
9-
}
10-
11-
public EVCSFileNotFound(String message) {
12-
super(message);
7+
public EVCSFileNotFound(String repoUrl, String branchName, String filePath, String revision) {
8+
super(String.format("file %s is not found in branch %s at revision %s of repo %s", filePath, branchName, revision == null ? "HEAD" : revision, repoUrl));
139
}
1410
}

src/test/java/org/scm4j/vcs/api/exceptions/ExceptionsTest.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
package org.scm4j.vcs.api.exceptions;
22

3-
import org.junit.Test;
4-
53
import static org.junit.Assert.assertEquals;
4+
import static org.junit.Assert.assertFalse;
65
import static org.junit.Assert.assertTrue;
76

7+
import org.junit.Test;
8+
89
public class ExceptionsTest {
910

1011
public static final String TEST_MESSAGE = "test message";
@@ -28,11 +29,8 @@ public void testEVCSBranchExists() {
2829

2930
@Test
3031
public void testEVCSFileNotFound() {
31-
EVCSFileNotFound e = new EVCSFileNotFound(TEST_MESSAGE);
32-
assertTrue(e.getMessage().contains(TEST_MESSAGE));
33-
EVCSFileNotFound e1 = new EVCSFileNotFound(e);
34-
assertTrue(e1.getMessage().contains(TEST_MESSAGE));
35-
assertEquals(e1.getCause(), e);
32+
EVCSFileNotFound e = new EVCSFileNotFound("test repo", "test branch", "test file", "test revision");
33+
assertFalse(e.getMessage().isEmpty());
3634
}
3735

3836
@Test

0 commit comments

Comments
 (0)