当前位置: 首页>>代码示例>>Java>>正文


Java JavaFileObjects.forResource方法代码示例

本文整理汇总了Java中com.google.testing.compile.JavaFileObjects.forResource方法的典型用法代码示例。如果您正苦于以下问题:Java JavaFileObjects.forResource方法的具体用法?Java JavaFileObjects.forResource怎么用?Java JavaFileObjects.forResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.testing.compile.JavaFileObjects的用法示例。


在下文中一共展示了JavaFileObjects.forResource方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: test_simple_interface_1

import com.google.testing.compile.JavaFileObjects; //导入方法依赖的package包/类
@Test
public void test_simple_interface_1() throws IOException {
    JavaFileObject[] files = {JavaFileObjects.forResource("jts/dev/InterFaceTest.java")};
    Compilation c = javac()
            .withProcessors(new TsGenProcessor())
            .withOptions("-AjtsgenModuleName=MyModule")
            .compile(files);

    assertEquals(0, c.errors().size());

    // check debug is disabled
    assertEquals(Logger.getLogger(TsGenProcessor.class.getPackage().getName()).getLevel(), Level.OFF);

    assertTrue(c.generatedFile(StandardLocation.SOURCE_OUTPUT, StringConstForTest.JTSGEN_MYMODULE, PACKAGE_JSON).isPresent());
    assertTrue(c.generatedFile(StandardLocation.SOURCE_OUTPUT, StringConstForTest.JTSGEN_MYMODULE, StringConstForTest.MY_MODULE_D_TS).isPresent());

    JavaFileObject testee2 = c.generatedFile(StandardLocation.SOURCE_OUTPUT, StringConstForTest.JTSGEN_MYMODULE, StringConstForTest.MY_MODULE_D_TS).get();

    ReferenceHelper.assertEquals(
            c.generatedFile(StandardLocation.SOURCE_OUTPUT, StringConstForTest.JTSGEN_MYMODULE, PACKAGE_JSON).get()
            , "simple_interface_1.package.json");

    ReferenceHelper.assertEquals(
            c.generatedFile(StandardLocation.SOURCE_OUTPUT, StringConstForTest.JTSGEN_MYMODULE, StringConstForTest.MY_MODULE_D_TS).get()
            , "simple_interface_1.my-module.d.ts");
}
 
开发者ID:dzuvic,项目名称:jtsgen,代码行数:27,代码来源:TsGenProcessorTest.java

示例2: simpleShortcutActivity

import com.google.testing.compile.JavaFileObjects; //导入方法依赖的package包/类
@Test
public void simpleShortcutActivity() {
    JavaFileObject source = JavaFileObjects.forResource("SimpleShortcutActivity.java");
    JavaFileObject generated = JavaFileObjects.forResource("SimpleShortcutActivityGenerated.java");
    assertAbout(javaSource()).that(source)
            .processedWith(new ShortcutProcessor())
            .compilesWithoutError()
            .and()
            .generatesSources(generated);
}
 
开发者ID:MatthiasRobbers,项目名称:shortbread,代码行数:11,代码来源:ActivityShortcutTest.java

示例3: check_simple_ts_module_error

import com.google.testing.compile.JavaFileObjects; //导入方法依赖的package包/类
@Test
public void check_simple_ts_module_error() {
    JavaFileObject[] files = {
            JavaFileObjects.forResource("jts/modules/tsmodule_error/InterFaceTestTsModuleError.java"),
            JavaFileObjects.forResource("jts/modules/tsmodule_error/package-info.java")
    };
    Compilation c = javac()
            .withProcessors(new TsGenProcessor())
            .withOptions("-AjtsgenLogLevel=none")
            .compile(files);

    assertTrue(c.errors().size() > 0);
    boolean v1 = c.errors().stream().anyMatch( x -> x.getMessage(Locale.ENGLISH).contains("param not valid. Expecting a name space"));
    boolean v2 = c.errors().stream().anyMatch( x -> x.getMessage(Locale.ENGLISH).contains("param not valid. Expecting origin and target"));
    boolean v3 = c.errors().stream().anyMatch( x -> x.getMessage(Locale.ENGLISH).contains("param not valid. Expecting a regular Expression."));

    // at least one of the error must exists
    assertTrue( v1 || v2 || v3);
}
 
开发者ID:dzuvic,项目名称:jtsgen,代码行数:20,代码来源:TsGenProcessorTest.java

示例4: processSuccessfulWhereTypeResolvedInInheritanceHierarchy

import com.google.testing.compile.JavaFileObjects; //导入方法依赖的package包/类
@Test
public void processSuccessfulWhereTypeResolvedInInheritanceHierarchy()
  throws Exception
{
  final JavaFileObject source1 = JavaFileObjects.forResource( "input/com/example/type_params/AbstractModel.java" );
  final JavaFileObject source2 = JavaFileObjects.forResource( "input/com/example/type_params/MiddleModel.java" );
  final JavaFileObject source3 = JavaFileObjects.forResource( "input/com/example/type_params/ConcreteModel.java" );
  final String output1 = "expected/com/example/type_params/Arez_ConcreteModel.java";
  assertSuccessfulCompile( Arrays.asList( source1, source2, source3 ), Collections.singletonList( output1 ) );
}
 
开发者ID:arez,项目名称:arez,代码行数:11,代码来源:ArezProcessorTest.java

示例5: testDummyGroup

import com.google.testing.compile.JavaFileObjects; //导入方法依赖的package包/类
@Test
public void testDummyGroup() throws FileNotFoundException {
    JavaFileObject model = JavaFileObjects.forResource("input/ModelDummyGroup.java");
    JavaFileObject autoModel = JavaFileObjects.forResource("expected/ModelDummyGroup.java");
    assertAbout(javaSources())
            .that(Arrays.asList(model))
            .processedWith(autoValueProcessor)
            .compilesWithoutError()
            .and()
            .generatesSources(autoModel);
}
 
开发者ID:ccheptea,项目名称:auto-value-variant,代码行数:12,代码来源:AutoValueVariantExtensionTest.java

示例6: processResolvedParameterizedType

import com.google.testing.compile.JavaFileObjects; //导入方法依赖的package包/类
@Test
public void processResolvedParameterizedType()
  throws Exception
{
  final JavaFileObject source1 =
    JavaFileObjects.forResource( "input/com/example/parameterized_type/ParentModel.java" );
  final JavaFileObject source2 =
    JavaFileObjects.forResource( "input/com/example/parameterized_type/ResolvedModel.java" );
  final String output1 = "expected/com/example/parameterized_type/Arez_ResolvedModel.java";
  assertSuccessfulCompile( Arrays.asList( source1, source2 ), Collections.singletonList( output1 ) );
}
 
开发者ID:arez,项目名称:arez,代码行数:12,代码来源:ArezProcessorTest.java

示例7: processUnresolvedParameterizedType

import com.google.testing.compile.JavaFileObjects; //导入方法依赖的package包/类
@Test
public void processUnresolvedParameterizedType()
  throws Exception
{
  final JavaFileObject source1 =
    JavaFileObjects.forResource( "input/com/example/parameterized_type/ParentModel.java" );
  final JavaFileObject source2 =
    JavaFileObjects.forResource( "input/com/example/parameterized_type/UnresolvedModel.java" );
  final String output1 = "expected/com/example/parameterized_type/Arez_UnresolvedModel.java";
  assertSuccessfulCompile( Arrays.asList( source1, source2 ), Collections.singletonList( output1 ) );
}
 
开发者ID:arez,项目名称:arez,代码行数:12,代码来源:ArezProcessorTest.java

示例8: disabledShortcutActivity

import com.google.testing.compile.JavaFileObjects; //导入方法依赖的package包/类
@Test
public void disabledShortcutActivity() {
    JavaFileObject source = JavaFileObjects.forResource("DisabledShortcutActivity.java");
    JavaFileObject generated = JavaFileObjects.forResource("DisabledShortcutActivityGenerated.java");
    assertAbout(javaSource()).that(source)
            .processedWith(new ShortcutProcessor())
            .compilesWithoutError()
            .and()
            .generatesSources(generated);
}
 
开发者ID:MatthiasRobbers,项目名称:shortbread,代码行数:11,代码来源:ActivityShortcutTest.java

示例9: processSuccessfulInheritedProtectedAccessInDifferentPackage

import com.google.testing.compile.JavaFileObjects; //导入方法依赖的package包/类
@Test
public void processSuccessfulInheritedProtectedAccessInDifferentPackage()
  throws Exception
{
  final JavaFileObject source1 =
    JavaFileObjects.forResource( "input/com/example/tracked/InheritProtectedAccessTrackedModel.java" );
  final JavaFileObject source2 =
    JavaFileObjects.forResource( "input/com/example/tracked/other/BaseModelProtectedAccess.java" );
  final String output = "expected/com/example/tracked/Arez_InheritProtectedAccessTrackedModel.java";
  assertSuccessfulCompile( Arrays.asList( source1, source2 ), Collections.singletonList( output ) );
}
 
开发者ID:arez,项目名称:arez,代码行数:12,代码来源:ArezProcessorTest.java

示例10: processSuccessfulWhereTraceInheritanceChain

import com.google.testing.compile.JavaFileObjects; //导入方法依赖的package包/类
@Test
public void processSuccessfulWhereTraceInheritanceChain()
  throws Exception
{
  final JavaFileObject source1 = JavaFileObjects.forResource( "input/com/example/inheritance/BaseModel.java" );
  final JavaFileObject source2 = JavaFileObjects.forResource( "input/com/example/inheritance/ParentModel.java" );
  final JavaFileObject source3 = JavaFileObjects.forResource( "input/com/example/inheritance/MyModel.java" );
  final JavaFileObject source4 = JavaFileObjects.forResource( "input/com/example/inheritance/MyInterface1.java" );
  final JavaFileObject source5 = JavaFileObjects.forResource( "input/com/example/inheritance/MyInterface2.java" );
  final String output1 = "expected/com/example/inheritance/Arez_MyModel.java";
  assertSuccessfulCompile( Arrays.asList( source1, source2, source3, source4, source5 ),
                           Collections.singletonList( output1 ) );
}
 
开发者ID:arez,项目名称:arez,代码行数:14,代码来源:ArezProcessorTest.java

示例11: targetShortcutActivity

import com.google.testing.compile.JavaFileObjects; //导入方法依赖的package包/类
@Test
public void targetShortcutActivity() {
    List<JavaFileObject> sources = Arrays.asList(
            JavaFileObjects.forResource("EmptyActivity1.java"),
            JavaFileObjects.forResource("TargetShortcutActivity.java")
    );
    JavaFileObject generated = JavaFileObjects.forResource("TargetShortcutActivityGenerated.java");
    assertAbout(javaSources()).that(sources)
            .processedWith(new ShortcutProcessor())
            .compilesWithoutError()
            .and()
            .generatesSources(generated);
}
 
开发者ID:MatthiasRobbers,项目名称:shortbread,代码行数:14,代码来源:ActivityShortcutTest.java

示例12: check_simple_interface_No_Logging

import com.google.testing.compile.JavaFileObjects; //导入方法依赖的package包/类
@Test
public void check_simple_interface_No_Logging() {
    JavaFileObject[] files = {JavaFileObjects.forResource("jts/dev/InterFaceTest.java")};
    Compilation c = javac()
            .withProcessors(new TsGenProcessor())
            .withOptions("-Agone=nowhere", "-AjtsgenLogLevel=DUMMY")
            .compile(files);

    // check that any logging is disabled is disabled
    assertEquals(Logger.getLogger(TsGenProcessor.class.getPackage().getName()).getLevel(), Level.OFF);
}
 
开发者ID:dzuvic,项目名称:jtsgen,代码行数:12,代码来源:TsGenProcessorTest.java

示例13: advancedShortcutActivity

import com.google.testing.compile.JavaFileObjects; //导入方法依赖的package包/类
@Test
public void advancedShortcutActivity() {
    JavaFileObject source = JavaFileObjects.forResource("AdvancedShortcutActivity.java");
    JavaFileObject generated = JavaFileObjects.forResource("AdvancedShortcutActivityGenerated.java");
    assertAbout(javaSource()).that(source)
            .processedWith(new ShortcutProcessor())
            .compilesWithoutError()
            .and()
            .generatesSources(generated);
}
 
开发者ID:MatthiasRobbers,项目名称:shortbread,代码行数:11,代码来源:ActivityShortcutTest.java

示例14: backstackShortcutActivity

import com.google.testing.compile.JavaFileObjects; //导入方法依赖的package包/类
@Test
public void backstackShortcutActivity() {
    List<JavaFileObject> sources = Arrays.asList(
            JavaFileObjects.forResource("EmptyActivity1.java"),
            JavaFileObjects.forResource("EmptyActivity2.java"),
            JavaFileObjects.forResource("BackStackShortcutActivity.java")
    );
    JavaFileObject generated = JavaFileObjects.forResource("BackStackShortcutActivityGenerated.java");
    assertAbout(javaSources()).that(sources)
            .processedWith(new ShortcutProcessor())
            .compilesWithoutError()
            .and()
            .generatesSources(generated);
}
 
开发者ID:MatthiasRobbers,项目名称:shortbread,代码行数:15,代码来源:ActivityShortcutTest.java

示例15: testDefaultGroup

import com.google.testing.compile.JavaFileObjects; //导入方法依赖的package包/类
@Test
public void testDefaultGroup() throws FileNotFoundException {
    JavaFileObject model = JavaFileObjects.forResource("input/ModelDefaultGroup.java");
    JavaFileObject autoModel = JavaFileObjects.forResource("expected/ModelDefaultGroup.java");
    assertAbout(javaSources())
            .that(Arrays.asList(model))
            .processedWith(autoValueProcessor)
            .compilesWithoutError()
            .and()
            .generatesSources(autoModel);
}
 
开发者ID:ccheptea,项目名称:auto-value-variant,代码行数:12,代码来源:AutoValueVariantExtensionTest.java


注:本文中的com.google.testing.compile.JavaFileObjects.forResource方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。