### Question:
EnvAutodetectResource { @VisibleForTesting static Attributes parseResourceAttributes(@Nullable String rawEnvAttributes) { if (rawEnvAttributes == null) { return Attributes.empty(); } else { Attributes.Builder attrBuilders = Attributes.newBuilder(); String[] rawAttributes = rawEnvAttributes.split(ATTRIBUTE_LIST_SPLITTER, -1); for (String rawAttribute : rawAttributes) { String[] keyValuePair = rawAttribute.split(ATTRIBUTE_KEY_VALUE_SPLITTER, -1); if (keyValuePair.length != 2) { continue; } attrBuilders.setAttribute( keyValuePair[0].trim(), keyValuePair[1].trim().replaceAll("^\"|\"$", "")); } return attrBuilders.build(); } } private  EnvAutodetectResource();   }### Answer:
@Test void parseResourceAttributes_null() { assertThat(EnvAutodetectResource.parseResourceAttributes(null).isEmpty()).isTrue(); }
@Test void parseResourceAttributes_empty() { assertThat(EnvAutodetectResource.parseResourceAttributes("").isEmpty()).isTrue(); }
@Test void parseResourceAttributes_malformed() { assertThat(EnvAutodetectResource.parseResourceAttributes("value/foo").isEmpty()).isTrue(); }
@Test void parseResourceAttributes_single() { Attributes result = EnvAutodetectResource.parseResourceAttributes("value=foo"); assertThat(result).isEqualTo(Attributes.of(stringKey("value"), "foo")); }
@Test void parseResourceAttributes_multi() { Attributes result = EnvAutodetectResource.parseResourceAttributes("value=foo, other=bar"); assertThat(result) .isEqualTo( Attributes.of( stringKey("value"), "foo", stringKey("other"), "bar")); }
@Test void parseResourceAttributes_whitespace() { Attributes result = EnvAutodetectResource.parseResourceAttributes(" value = foo "); assertThat(result).isEqualTo(Attributes.of(stringKey("value"), "foo")); }
@Test void parseResourceAttributes_quotes() { Attributes result = EnvAutodetectResource.parseResourceAttributes("value=\"foo\""); assertThat(result).isEqualTo(Attributes.of(stringKey("value"), "foo")); }