Search in sources :

Example 6 with JavaClass

use of com.google.startupos.tools.build_file_generator.Protos.JavaClass in project startup-os by google.

the class JavaClassAnalyzerTest method hasMainMethodTest.

@Test
public void hasMainMethodTest() throws IOException {
    String fileContent = "package com.test.tests;" + System.lineSeparator() + "public class SomeClass {" + System.lineSeparator() + "  public static void main(String[] args) {}" + System.lineSeparator() + "}";
    String filePath = fileUtils.joinToAbsolutePath(testFolder, "SomeClass.java");
    fileUtils.writeStringUnchecked(fileContent, filePath);
    JavaClass expectedJavaClass = JavaClass.newBuilder().setPackage("com.test.tests").setClassName("SomeClass").setHasMainMethod(true).build();
    assertEquals(expectedJavaClass, javaClassAnalyzer.getJavaClass(filePath));
}
Also used : JavaClass(com.google.startupos.tools.build_file_generator.Protos.JavaClass) Test(org.junit.Test)

Aggregations

JavaClass (com.google.startupos.tools.build_file_generator.Protos.JavaClass)6 Test (org.junit.Test)3 BuildFile (com.google.startupos.tools.build_file_generator.Protos.BuildFile)2 JavaLibrary (com.google.startupos.tools.build_file_generator.Protos.BuildFile.JavaLibrary)2 JavaBinary (com.google.startupos.tools.build_file_generator.Protos.BuildFile.JavaBinary)1 JavaProtoLibrary (com.google.startupos.tools.build_file_generator.Protos.BuildFile.JavaProtoLibrary)1 JavaTest (com.google.startupos.tools.build_file_generator.Protos.BuildFile.JavaTest)1 LoadExtensionStatement (com.google.startupos.tools.build_file_generator.Protos.BuildFile.LoadExtensionStatement)1 ProtoLibrary (com.google.startupos.tools.build_file_generator.Protos.BuildFile.ProtoLibrary)1 ProtoFile (com.google.startupos.tools.build_file_generator.Protos.ProtoFile)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1