File tree Expand file tree Collapse file tree
javatests/com/google/auth/mtls
java/com/google/auth/mtls Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -123,12 +123,7 @@ private static File getWellKnownCertificateConfigFile(
123123 } else {
124124 String osName = propProvider .getProperty ("os.name" , "" ).toLowerCase (Locale .US );
125125 if (osName .indexOf ("windows" ) >= 0 ) {
126- String appData = envProvider .getEnv ("APPDATA" );
127- if (Strings .isNullOrEmpty (appData )) {
128- throw new CertificateSourceUnavailableException (
129- "APPDATA environment variable is not set on Windows." );
130- }
131- File appDataPath = new File (appData );
126+ File appDataPath = new File (envProvider .getEnv ("APPDATA" ));
132127 cloudConfigPath = new File (appDataPath , CLOUDSDK_CONFIG_DIRECTORY );
133128 } else {
134129 File configPath = new File (propProvider .getProperty ("user.home" , "" ), ".config" );
Original file line number Diff line number Diff line change @@ -219,28 +219,5 @@ public String getProperty(String name, String def) {
219219 assertTrue (exception .getMessage ().contains (expectedPath ));
220220 }
221221
222- @ Test
223- void getWellKnownCertificateConfigFile_windows_missingAppData_throws () {
224- EnvironmentProvider envProvider =
225- new EnvironmentProvider () {
226- @ Override
227- public String getEnv (String name ) {
228- return null ;
229- }
230- };
231- PropertyProvider propProvider =
232- new PropertyProvider () {
233- @ Override
234- public String getProperty (String name , String def ) {
235- return "os.name" .equals (name ) ? "Windows 10" : def ;
236- }
237- };
238-
239- CertificateSourceUnavailableException exception =
240- assertThrows (
241- CertificateSourceUnavailableException .class ,
242- () -> MtlsUtils .getWorkloadCertificateConfiguration (envProvider , propProvider , null ));
243222
244- assertEquals ("APPDATA environment variable is not set on Windows." , exception .getMessage ());
245- }
246223}
You can’t perform that action at this time.
0 commit comments