|
28 | 28 | import com.google.devtools.build.lib.vfs.PathFragment;
|
29 | 29 | import com.google.devtools.build.lib.vfs.inmemoryfs.InMemoryFileSystem;
|
30 | 30 | import com.google.devtools.build.runfiles.Runfiles;
|
31 |
| -import java.io.IOException; |
32 | 31 | import java.net.URI;
|
33 | 32 | import java.time.Duration;
|
34 | 33 | import org.junit.Test;
|
@@ -95,18 +94,20 @@ public void knownUriWithMultipleHeaders() throws Exception {
|
95 | 94 |
|
96 | 95 | @Test
|
97 | 96 | public void unknownUri() {
|
98 |
| - IOException ioException = |
| 97 | + CredentialHelperException e = |
99 | 98 | assertThrows(
|
100 |
| - IOException.class, () -> getCredentialsFromHelper("https://unknown.example.com")); |
101 |
| - assertThat(ioException).hasMessageThat().contains("Unknown uri 'https://unknown.example.com'"); |
| 99 | + CredentialHelperException.class, |
| 100 | + () -> getCredentialsFromHelper("https://unknown.example.com")); |
| 101 | + assertThat(e).hasMessageThat().contains("Unknown uri 'https://unknown.example.com'"); |
102 | 102 | }
|
103 | 103 |
|
104 | 104 | @Test
|
105 | 105 | public void credentialHelperOutputsNothing() throws Exception {
|
106 |
| - IOException ioException = |
| 106 | + CredentialHelperException e = |
107 | 107 | assertThrows(
|
108 |
| - IOException.class, () -> getCredentialsFromHelper("https://printnothing.example.com")); |
109 |
| - assertThat(ioException).hasMessageThat().contains("exited without output"); |
| 108 | + CredentialHelperException.class, |
| 109 | + () -> getCredentialsFromHelper("https://printnothing.example.com")); |
| 110 | + assertThat(e).hasMessageThat().contains("exited without output"); |
110 | 111 | }
|
111 | 112 |
|
112 | 113 | @Test
|
@@ -135,9 +136,10 @@ public void helperGetEnvironment() throws Exception {
|
135 | 136 |
|
136 | 137 | @Test
|
137 | 138 | public void helperTimeout() throws Exception {
|
138 |
| - IOException ioException = |
| 139 | + CredentialHelperException e = |
139 | 140 | assertThrows(
|
140 |
| - IOException.class, () -> getCredentialsFromHelper("https://timeout.example.com")); |
141 |
| - assertThat(ioException).hasMessageThat().contains("process timed out"); |
| 141 | + CredentialHelperException.class, |
| 142 | + () -> getCredentialsFromHelper("https://timeout.example.com")); |
| 143 | + assertThat(e).hasMessageThat().contains("process timed out"); |
142 | 144 | }
|
143 | 145 | }
|
0 commit comments