Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.

Commit a2e077f

Browse files
committed
test: updated test error messages for directory checks
1 parent b035378 commit a2e077f

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

artiwrapper/src/androidTest/java/org/c4dt/artiwrapper/JniTest.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,7 @@ public void helloRustException() {
7272
@Test
7373
public void nullCacheDir() throws TorLibException {
7474
thrown.expect(TorLibException.class);
75-
thrown.expectMessage(containsString("cache_dir"));
76-
thrown.expectMessage(containsString("Null pointer"));
75+
thrown.expectMessage(containsString("create rust string for `cache_dir_j`: Null pointer in get_string obj argument"));
7776

7877
try (Client client = new Client(null)) {
7978
client.syncTorRequest(dummyMethod, dummyUrl, dummyHeaders, dummyBody);
@@ -83,7 +82,7 @@ public void nullCacheDir() throws TorLibException {
8382
@Test
8483
public void nonexistentCacheDir() throws TorLibException {
8584
thrown.expect(TorLibException.class);
86-
thrown.expectMessage(containsString("No such file or directory"));
85+
thrown.expectMessage(containsString("directory cache does not exist"));
8786

8887
try (Client client = new Client(dummyCacheDir)) {
8988
client.syncTorRequest(dummyMethod, dummyUrl, dummyHeaders, dummyBody);
@@ -93,7 +92,9 @@ public void nonexistentCacheDir() throws TorLibException {
9392
@Test
9493
public void missingConsensus() throws TorLibException {
9594
thrown.expect(TorLibException.class);
96-
thrown.expectMessage(containsString("No such file or directory"));
95+
thrown.expectMessage(
96+
containsString("Corrupt cache: required file(s) missing in cache")
97+
);
9798

9899
File f = new File(folder.getRoot(), TorLibApi.CONSENSUS_FILENAME);
99100
assertTrue(f.delete());
@@ -106,7 +107,9 @@ public void missingConsensus() throws TorLibException {
106107
@Test
107108
public void missingMicroDescriptors() throws TorLibException {
108109
thrown.expect(TorLibException.class);
109-
thrown.expectMessage(containsString("No such file or directory"));
110+
thrown.expectMessage(
111+
containsString("Corrupt cache: required file(s) missing in cache")
112+
);
110113

111114
File f = new File(folder.getRoot(), TorLibApi.MICRODESCRIPTORS_FILENAME);
112115
assertTrue(f.delete());
@@ -119,7 +122,9 @@ public void missingMicroDescriptors() throws TorLibException {
119122
@Test
120123
public void missingAuthority() throws TorLibException {
121124
thrown.expect(TorLibException.class);
122-
thrown.expectMessage(containsString("Failed to read authority"));
125+
thrown.expectMessage(
126+
containsString("Corrupt cache: required file(s) missing in cache")
127+
);
123128

124129
File f = new File(folder.getRoot(), TorLibApi.AUTHORITY_FILENAME);
125130
assertTrue(f.delete());
@@ -132,7 +137,9 @@ public void missingAuthority() throws TorLibException {
132137
@Test
133138
public void missingCertificate() throws TorLibException {
134139
thrown.expect(TorLibException.class);
135-
thrown.expectMessage(containsString("No such file or directory"));
140+
thrown.expectMessage(
141+
containsString("Corrupt cache: required file(s) missing in cache")
142+
);
136143

137144
File f = new File(folder.getRoot(), TorLibApi.CERTIFICATE_FILENAME);
138145
assertTrue(f.delete());

0 commit comments

Comments
 (0)