Search in sources :

Example 1 with DoctorConfig

use of com.facebook.buck.doctor.config.DoctorConfig in project buck by facebook.

the class DoctorReportHelperTest method testNoAvailableSuggestions.

@Test
public void testNoAvailableSuggestions() throws Exception {
    TestConsole console = new TestConsole();
    DoctorConfig doctorConfig = DoctorConfig.of(FakeBuckConfig.builder().setSections(ImmutableMap.of(DoctorConfig.DOCTOR_SECTION, ImmutableMap.of(DoctorConfig.URL_FIELD, "url"))).build());
    DoctorReportHelper helper = new DoctorReportHelper(workspace.asCell().getFilesystem(), (new UserInputFixture("0")).getUserInput(), console, objectMapper, doctorConfig);
    DoctorEndpointResponse response = DoctorEndpointResponse.of(Optional.empty(), ImmutableList.of());
    helper.presentResponse(response);
    assertEquals("\n:: No available suggestions right now.\n\n", console.getTextWrittenToStdOut());
}
Also used : UserInputFixture(com.facebook.buck.rage.UserInputFixture) DoctorEndpointResponse(com.facebook.buck.doctor.config.DoctorEndpointResponse) TestConsole(com.facebook.buck.testutil.TestConsole) DoctorConfig(com.facebook.buck.doctor.config.DoctorConfig) Test(org.junit.Test)

Example 2 with DoctorConfig

use of com.facebook.buck.doctor.config.DoctorConfig in project buck by facebook.

the class DoctorReportHelperTest method testErrorMessage.

@Test
public void testErrorMessage() throws Exception {
    TestConsole console = new TestConsole();
    DoctorConfig doctorConfig = DoctorConfig.of(FakeBuckConfig.builder().setSections(ImmutableMap.of(DoctorConfig.DOCTOR_SECTION, ImmutableMap.of(DoctorConfig.URL_FIELD, "url"))).build());
    DoctorReportHelper helper = new DoctorReportHelper(workspace.asCell().getFilesystem(), (new UserInputFixture("0")).getUserInput(), console, objectMapper, doctorConfig);
    String errorMessage = "This is an error message.";
    DoctorEndpointResponse response = DoctorEndpointResponse.of(Optional.of(errorMessage), ImmutableList.of());
    helper.presentResponse(response);
    assertEquals("=> " + errorMessage + "\n", console.getTextWrittenToStdOut());
}
Also used : UserInputFixture(com.facebook.buck.rage.UserInputFixture) DoctorEndpointResponse(com.facebook.buck.doctor.config.DoctorEndpointResponse) TestConsole(com.facebook.buck.testutil.TestConsole) DoctorConfig(com.facebook.buck.doctor.config.DoctorConfig) Test(org.junit.Test)

Aggregations

DoctorConfig (com.facebook.buck.doctor.config.DoctorConfig)2 DoctorEndpointResponse (com.facebook.buck.doctor.config.DoctorEndpointResponse)2 UserInputFixture (com.facebook.buck.rage.UserInputFixture)2 TestConsole (com.facebook.buck.testutil.TestConsole)2 Test (org.junit.Test)2