public class TestInputFileBuilder extends Object
InputFile
s.
An InputFile is unambiguously identified by a module key and a relative path, so these parameters are mandatory.
A module base directory is only needed to construct absolute paths.
Examples of usage of the constructors:
InputFile file1 = TestInputFileBuilder.create("module1", "myfile.java").build(); InputFile file2 = TestInputFileBuilder.create("", fs.baseDir(), myfile).build();file1 will have the "module1" as both module key and module base directory. file2 has an empty string as module key, and a relative path which is the path from the filesystem base directory to myfile.
Constructor and Description |
---|
TestInputFileBuilder(String moduleKey,
File moduleBaseDir,
File filePath)
Create a InputFile with a given module key and module base directory.
|
TestInputFileBuilder(String moduleKey,
String relativePath)
Create a InputFile identified by the given module key and relative path.
|
TestInputFileBuilder(String moduleKey,
String relativePath,
int id) |
public TestInputFileBuilder(String moduleKey, String relativePath)
public TestInputFileBuilder(String moduleKey, File moduleBaseDir, File filePath)
public TestInputFileBuilder(String moduleKey, String relativePath, int id)
public static TestInputFileBuilder create(String moduleKey, File moduleBaseDir, File filePath)
public static TestInputFileBuilder create(String moduleKey, String relativePath)
public static int nextBatchId()
public TestInputFileBuilder setModuleBaseDir(Path moduleBaseDir)
public TestInputFileBuilder setLanguage(@Nullable String language)
public TestInputFileBuilder setType(InputFile.Type type)
public TestInputFileBuilder setStatus(InputFile.Status status)
public TestInputFileBuilder setLines(int lines)
public TestInputFileBuilder setCharset(Charset charset)
public TestInputFileBuilder setLastValidOffset(int lastValidOffset)
public TestInputFileBuilder setHash(String hash)
public TestInputFileBuilder setContents(String content)
InputFile.contents()
and InputFile.inputStream()
and can be
inconsistent with the actual physical file pointed by InputFile.path()
, InputFile.absolutePath()
, etc.public TestInputFileBuilder setNonBlankLines(int nonBlankLines)
public TestInputFileBuilder setOriginalLineOffsets(int[] originalLineOffsets)
public TestInputFileBuilder setPublish(boolean publish)
public TestInputFileBuilder setMetadata(Metadata metadata)
public TestInputFileBuilder initMetadata(String content)
public DefaultInputFile build()
public static DefaultInputModule newDefaultInputModule(String moduleKey, File baseDir)
public static DefaultInputModule newDefaultInputModule(ProjectDefinition projectDefinition)
Copyright © 2009–2018 SonarSource. All rights reserved.