use of com.facebook.buck.util.FakeUserIdFetcher in project buck by facebook.
the class AppleCoreSimulatorServiceControllerTest method coreSimulatorServicePathFetchedFromLaunchctlPrint.
@Test
public void coreSimulatorServicePathFetchedFromLaunchctlPrint() throws IOException, InterruptedException {
ImmutableList.Builder<Map.Entry<ProcessExecutorParams, FakeProcess>> fakeProcessesBuilder = ImmutableList.builder();
fakeProcessesBuilder.add(new SimpleImmutableEntry<>(LAUNCHCTL_LIST_PARAMS, new FakeProcess(0, "87823\t0\tcom.apple.CoreSimulator.CoreSimulatorService.117.15.1.lkhDXxRPp5yy\n", "")));
fakeProcessesBuilder.add(new SimpleImmutableEntry<>(ProcessExecutorParams.builder().setCommand(ImmutableList.of("launchctl", "print", "user/42/com.apple.CoreSimulator.CoreSimulatorService.117.15.1.lkhDXxRPp5yy")).build(), new FakeProcess(0, "com.apple.CoreSimulator.CoreSimulatorService.117.15.1.lkhDXxRPp5yy = {\n" + " path = xcode-dir/Developer/Library/PrivateFrameworks/CoreSimulator.framework" + "/Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc\n" + "}\n", "")));
FakeProcessExecutor fakeProcessExecutor = new FakeProcessExecutor(fakeProcessesBuilder.build());
AppleCoreSimulatorServiceController appleCoreSimulatorServiceController = new AppleCoreSimulatorServiceController(fakeProcessExecutor);
Optional<Path> coreSimulatorServicePath = appleCoreSimulatorServiceController.getCoreSimulatorServicePath(new FakeUserIdFetcher(42));
Optional<Path> expected = Optional.of(Paths.get("xcode-dir/Developer/Library/PrivateFrameworks/CoreSimulator.framework/" + "Versions/A/XPCServices/com.apple.CoreSimulator.CoreSimulatorService.xpc"));
assertThat(coreSimulatorServicePath, is(equalTo(expected)));
}
Aggregations