Skip to content

Commit 983f014

Browse files
authored
Merge pull request bcgov#151 from sdevalapurkar/sd-exception-tests
Add and update exception file tests
2 parents b187497 + 56a23d8 commit 983f014

File tree

6 files changed

+138
-1
lines changed

6 files changed

+138
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package ca.bc.gov.open.jrccaccess.autoconfigure.config.exceptions;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.assertEquals;
6+
7+
public class KnownHostFileNotDefinedExceptionTests {
8+
9+
10+
@Test
11+
public void constructor_with_message_should_create_a_new_exception() {
12+
13+
KnownHostFileNotDefinedException sut = new KnownHostFileNotDefinedException("not defined");
14+
15+
assertEquals("not defined", sut.getMessage());
16+
17+
}
18+
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package ca.bc.gov.open.jrccaccess.autoconfigure.config.exceptions;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.assertEquals;
6+
7+
public class KnownHostFileNotFoundExceptionTests {
8+
9+
10+
@Test
11+
public void constructor_with_message_should_create_a_new_exception() {
12+
13+
KnownHostFileNotFoundException sut = new KnownHostFileNotFoundException("not found");
14+
15+
assertEquals("not found", sut.getMessage());
16+
17+
}
18+
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package ca.bc.gov.open.jrccaccess.libs.services.exceptions;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.assertEquals;
6+
7+
public class DocumentDigestMatchFailedExceptionTests {
8+
9+
10+
@Test
11+
public void constructor_with_message_should_create_a_new_exception() {
12+
13+
DocumentDigestMatchFailedException sut = new DocumentDigestMatchFailedException("match failed");
14+
15+
assertEquals("match failed", sut.getMessage());
16+
17+
}
18+
19+
@Test
20+
public void constructor_with_message_and_cause_should_create_a_new_exception(){
21+
22+
DocumentDigestMatchFailedException sut = new DocumentDigestMatchFailedException("match failed", new RuntimeException());
23+
24+
assertEquals("match failed", sut.getMessage());
25+
assertEquals(RuntimeException.class, sut.getCause().getClass());
26+
27+
}
28+
29+
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package ca.bc.gov.open.jrccaccess.libs.services.exceptions;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.assertEquals;
6+
7+
public class DocumentFilenameMissingExceptionTests {
8+
9+
10+
@Test
11+
public void constructor_with_message_should_create_a_new_exception() {
12+
13+
DocumentFilenameMissingException sut = new DocumentFilenameMissingException("filename missing");
14+
15+
assertEquals("filename missing", sut.getMessage());
16+
17+
}
18+
19+
@Test
20+
public void constructor_with_message_and_cause_should_create_a_new_exception(){
21+
22+
DocumentFilenameMissingException sut = new DocumentFilenameMissingException("filename missing", new RuntimeException());
23+
24+
assertEquals("filename missing", sut.getMessage());
25+
assertEquals(RuntimeException.class, sut.getCause().getClass());
26+
27+
}
28+
29+
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package ca.bc.gov.open.jrccaccess.libs.services.exceptions;
2+
3+
import org.junit.Test;
4+
5+
import static org.junit.Assert.assertEquals;
6+
7+
public class DocumentMessageExceptionTests {
8+
9+
10+
@Test
11+
public void constructor_should_create_a_new_exception() {
12+
13+
DocumentMessageException sut = new DocumentMessageException();
14+
15+
assertEquals(null, sut.getMessage());
16+
17+
}
18+
19+
@Test
20+
public void constructor_with_message_should_create_a_new_exception() {
21+
22+
DocumentMessageException sut = new DocumentMessageException("message exception");
23+
24+
assertEquals("message exception", sut.getMessage());
25+
26+
}
27+
28+
@Test
29+
public void constructor_with_message_and_cause_should_create_a_new_exception(){
30+
31+
DocumentMessageException sut = new DocumentMessageException("message exception", new RuntimeException());
32+
33+
assertEquals("message exception", sut.getMessage());
34+
assertEquals(RuntimeException.class, sut.getCause().getClass());
35+
36+
}
37+
38+
39+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import static org.junit.Assert.assertEquals;
66

7-
public class DocumentNotFoundExceptionTester {
7+
public class DocumentNotFoundExceptionTests {
88

99

1010
@Test

0 commit comments

Comments
 (0)