-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expand file tree
/
Copy pathExceptionsInstrumentationTest.java
More file actions
56 lines (46 loc) · 1.7 KB
/
ExceptionsInstrumentationTest.java
File metadata and controls
56 lines (46 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package it.feio.android.omninotes.exceptions;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import it.feio.android.omninotes.exceptions.unchecked.ExternalDirectoryCreationException;
import it.feio.android.omninotes.exceptions.checked.UnhandledIntentException;
import static org.junit.Assert.assertThrows;
@RunWith(AndroidJUnit4.class)
public class ExceptionsInstrumentationTest {
@Test
public void testGenericException() {
assertThrows(GenericException.class, () -> {
throw new GenericException("Test GenericException");
});
}
@Test
public void testDatabaseException() {
assertThrows(DatabaseException.class, () -> {
throw new DatabaseException("Test DatabaseException", new Exception("Cause"));
});
}
@Test
public void testBackupException() {
assertThrows(BackupException.class, () -> {
throw new BackupException("Test BackupException", new Exception("Cause"));
});
}
@Test
public void testNotesLoadingException() {
assertThrows(NotesLoadingException.class, () -> {
throw new NotesLoadingException("Test NotesLoadingException", new Exception("Cause"));
});
}
@Test
public void testUnhandledIntentException() {
assertThrows(UnhandledIntentException.class, () -> {
throw new UnhandledIntentException();
});
}
@Test
public void testExternalDirectoryCreationException() {
assertThrows(ExternalDirectoryCreationException.class, () -> {
throw new ExternalDirectoryCreationException("Test ExternalDirectoryCreationException");
});
}
}