### Question:
OperatingSystemFactory { private String getArchitecture() { String arch = systemProperties.getOsArch(); String architecture = null; if (arch != null) { architecture = arch.contains("64") ? "x86_64" : "i686"; } return architecture; } @Inject  OperatingSystemFactory(SystemProperties systemProperties,
                                LinuxProperties linuxProperties); OperatingSystem create();  }### Answer:
@Test public void testCreateMacOperatingSystem() { OperatingSystem operatingSystem = createMockOs("macos", "10", "x86_64"); assertThat(operatingSystem.getName()).isEqualTo("macos"); assertThat(operatingSystem.getVersion()).isEqualTo("10"); assertThat(operatingSystem.getArchitecture()).isEqualTo("x86_64"); assertThat(operatingSystem.getDistribution()).isNull(); assertThat(operatingSystem.getDistributionVersion()).isNull(); }
@Test public void testCreateWinOperatingSystem() { OperatingSystem operatingSystem = createMockOs("win", "7", "x64"); assertThat(operatingSystem.getName()).isEqualTo("win"); assertThat(operatingSystem.getVersion()).isEqualTo("7"); assertThat(operatingSystem.getArchitecture()).isEqualTo("x86_64"); assertThat(operatingSystem.getDistribution()).isNull(); assertThat(operatingSystem.getDistributionVersion()).isNull(); }
@Test public void testCreateLinuxOperatingSystem() { when(linuxProperties.getDistribution()).thenReturn("ubuntu"); when(linuxProperties.getDistributionVersion()).thenReturn("16.04"); OperatingSystem operatingSystem = createMockOs("linux", "4", "i686"); assertThat(operatingSystem.getName()).isEqualTo("linux"); assertThat(operatingSystem.getVersion()).isEqualTo("4"); assertThat(operatingSystem.getArchitecture()).isEqualTo("i686"); assertThat(operatingSystem.getDistribution()).isEqualTo("ubuntu"); assertThat(operatingSystem.getDistributionVersion()).isEqualTo("16.04"); }