Class TestInputFileBuilder


  • public class TestInputFileBuilder
    extends java.lang.Object
    Intended to be used in unit tests that need to create InputFiles. 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.

    Since:
    6.3
    • Constructor Detail

      • TestInputFileBuilder

        public TestInputFileBuilder​(java.lang.String projectKey,
                                    java.lang.String relativePath)
        Create a InputFile identified by the given project key and relative path.
      • TestInputFileBuilder

        public TestInputFileBuilder​(java.lang.String projectKey,
                                    java.io.File moduleBaseDir,
                                    java.io.File filePath)
        Create a InputFile with a given module key and module base directory. The relative path is generated comparing the file path to the module base directory. filePath must point to a file that is within the module base directory.
      • TestInputFileBuilder

        public TestInputFileBuilder​(java.lang.String projectKey,
                                    java.lang.String relativePath,
                                    int id)