Skip to content

Commit 84c8663

Browse files
committed
Util: AdvancedTlsX509TrustManager code changes for handling fine not found
1 parent cd44f7d commit 84c8663

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

util/src/test/java/io/grpc/util/AdvancedTlsX509TrustManagerTest.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import static org.junit.Assert.assertEquals;
2121
import static org.junit.Assert.assertNotNull;
2222
import static org.junit.Assert.assertThrows;
23-
import static org.junit.Assert.assertTrue;
2423
import static org.mockito.Mockito.mock;
2524
import static org.mockito.Mockito.when;
2625

@@ -31,7 +30,6 @@
3130
import io.grpc.testing.TlsTesting;
3231
import io.grpc.util.AdvancedTlsX509TrustManager.Verification;
3332
import java.io.File;
34-
import java.io.FileNotFoundException;
3533
import java.io.IOException;
3634
import java.lang.reflect.Method;
3735
import java.net.Socket;
@@ -156,8 +154,8 @@ public void missingFile_throwsFileNotFoundException() throws Exception {
156154
Exception thrown = assertThrows(
157155
Exception.class, () -> readAndUpdateMethod.invoke(trustManager, nonExistentFile, 0L));
158156

159-
assertTrue("Should throw FileNotFoundException, but got: " + thrown.getCause(),
160-
thrown.getCause() instanceof FileNotFoundException);
157+
assertEquals(thrown.getCause().getMessage(),
158+
"Certificate not found: " + nonExistentFile.getAbsolutePath());
161159
}
162160

163161
@Test

0 commit comments

Comments
 (0)