Search in sources :

Example 1 with ReadValuesStep

use of com.facebook.buck.android.AndroidBuildConfig.ReadValuesStep in project buck by facebook.

the class AndroidBuildConfigTest method testReadValuesStep.

@Test
public void testReadValuesStep() throws IOException {
    Path pathToValues = Paths.get("src/values.txt");
    ProjectFilesystem projectFilesystem = EasyMock.createMock(ProjectFilesystem.class);
    EasyMock.expect(projectFilesystem.readLines(pathToValues)).andReturn(ImmutableList.of("boolean DEBUG = false", "String FOO = \"BAR\""));
    EasyMock.replay(projectFilesystem);
    ReadValuesStep step = new ReadValuesStep(projectFilesystem, pathToValues);
    ExecutionContext context = TestExecutionContext.newBuilder().build();
    int exitCode = step.execute(context).getExitCode();
    assertEquals(0, exitCode);
    assertEquals(BuildConfigFields.fromFields(ImmutableList.of(BuildConfigFields.Field.of("boolean", "DEBUG", "false"), BuildConfigFields.Field.of("String", "FOO", "\"BAR\""))), step.get());
    EasyMock.verify(projectFilesystem);
}
Also used : Path(java.nio.file.Path) ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath) ExecutionContext(com.facebook.buck.step.ExecutionContext) TestExecutionContext(com.facebook.buck.step.TestExecutionContext) FakeProjectFilesystem(com.facebook.buck.testutil.FakeProjectFilesystem) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) ReadValuesStep(com.facebook.buck.android.AndroidBuildConfig.ReadValuesStep) Test(org.junit.Test)

Aggregations

ReadValuesStep (com.facebook.buck.android.AndroidBuildConfig.ReadValuesStep)1 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)1 ExplicitBuildTargetSourcePath (com.facebook.buck.rules.ExplicitBuildTargetSourcePath)1 ExecutionContext (com.facebook.buck.step.ExecutionContext)1 TestExecutionContext (com.facebook.buck.step.TestExecutionContext)1 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)1 Path (java.nio.file.Path)1 Test (org.junit.Test)1