### Question:
OsResource extends ResourceProvider { @Override protected Attributes getAttributes() { final String os; try { os = System.getProperty("os.name"); } catch (SecurityException t) { return Attributes.empty(); } if (os == null) { return Attributes.empty(); } Attributes.Builder attributes = Attributes.newBuilder(); String osName = getOs(os); if (osName != null) { attributes.setAttribute(ResourceAttributes.OS_NAME, osName); } String version = null; try { version = System.getProperty("os.version"); } catch (SecurityException e) { } String osDescription = version != null ? os + ' ' + version : os; attributes.setAttribute(ResourceAttributes.OS_DESCRIPTION, osDescription); return attributes.build(); }    }### Answer:
@Test void linux() { assumeThat(System.getProperty("os.name").toLowerCase()).startsWith("linux"); Attributes attributes = RESOURCE.getAttributes(); assertThat(attributes.get(ResourceAttributes.OS_NAME)).isEqualTo("LINUX"); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty(); }
@Test void macos() { assumeThat(System.getProperty("os.name").toLowerCase()).startsWith("mac"); Attributes attributes = RESOURCE.getAttributes(); assertThat(attributes.get(ResourceAttributes.OS_NAME)).isEqualTo("DARWIN"); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty(); }
@Test void windows() { assumeThat(System.getProperty("os.name").toLowerCase()).startsWith("windows"); Attributes attributes = RESOURCE.getAttributes(); assertThat(attributes.get(ResourceAttributes.OS_NAME)).isEqualTo("WINDOWS"); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotEmpty(); }
@Test void inDefault() { ReadableAttributes attributes = Resource.getDefault().getAttributes(); assertThat(attributes.get(ResourceAttributes.OS_NAME)).isNotNull(); assertThat(attributes.get(ResourceAttributes.OS_DESCRIPTION)).isNotNull(); }