Codota Logo
JavaFileObjects.forSourceLines
Code IndexAdd Codota to your IDE (free)

How to use
forSourceLines
method
in
com.google.testing.compile.JavaFileObjects

Best Java code snippets using com.google.testing.compile.JavaFileObjects.forSourceLines (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: google/compile-testing

/**
 * Behaves exactly like {@link #forSourceString}, but joins lines so that multi-line source
 * strings may omit the newline characters.  For example: <pre>   {@code
 *
 *   JavaFileObjects.forSourceLines("example.HelloWorld",
 *       "package example;",
 *       "",
 *       "final class HelloWorld {",
 *       "  void sayHello() {",
 *       "    System.out.println(\"hello!\");",
 *       "  }",
 *       "}");
 *   }</pre>
 */
public static JavaFileObject forSourceLines(String fullyQualifiedName, String... lines) {
 return forSourceLines(fullyQualifiedName, Arrays.asList(lines));
}
origin: google/compile-testing

/** Parses the source given and produces a {@link ParseResult}. */
static ParseResult parseLines(Iterable<String> source) {
 return Parser.parse(ImmutableList.of(JavaFileObjects.forSourceLines("", source)));
}
origin: com.google.testing.compile/compile-testing

/** Parses the source given and produces a {@link ParseResult}. */
static ParseResult parseLines(Iterable<String> source) {
 return Parser.parse(ImmutableList.of(JavaFileObjects.forSourceLines("", source)));
}
origin: google/compile-testing

/** Parses the source given into a {@link CompilationUnitTree}. */
static CompilationUnitTree parseLinesToTree(Iterable<String> source) {
 Iterable<? extends CompilationUnitTree> parseResults =
   Parser.parse(ImmutableList.of(JavaFileObjects.forSourceLines("", source)))
     .compilationUnits();
 return Iterables.getOnlyElement(parseResults);
}
origin: com.google.testing.compile/compile-testing

/** Parses the source given into a {@link CompilationUnitTree}. */
static CompilationUnitTree parseLinesToTree(Iterable<String> source) {
 Iterable<? extends CompilationUnitTree> parseResults =
   Parser.parse(ImmutableList.of(JavaFileObjects.forSourceLines("", source)))
     .compilationUnits();
 return Iterables.getOnlyElement(parseResults);
}
origin: izumin5210/Droidux

@Test
public void combinedReducerAndBindableReducer() {
  assertJavaSource(
      forSourceLines("RootStore", Source.CombinedReducerAndBindableReducer.TARGET),
      forSourceLines("DroiduxRootStore_CounterStoreImpl", Source.StoreImpl.COUNTER),
      forSourceLines("DroiduxRootStore_TodoListStoreImpl", Source.StoreImpl.TODO_LIST),
      forSourceLines("DroiduxRootStore", Source.CombinedReducerAndBindableReducer.GENERATED)
  );
}
origin: izumin5210/Droidux

@Test
public void combinedTwoReducers() {
  assertJavaSource(
      forSourceLines("RootStore", Source.CombinedTwoReducers.TARGET),
      forSourceLines("DroiduxRootStore_CounterStoreImpl", Source.StoreImpl.COUNTER),
      forSourceLines("DroiduxRootStore_TodoListStoreImpl", Source.StoreImpl.TODO_LIST),
      forSourceLines("DroiduxRootStore", Source.CombinedTwoReducers.GENERATED)
  );
}
origin: izumin5210/Droidux

@Test
public void singleReducerBindable() {
  assertJavaSource(
      forSourceLines("RootStore", Source.BindableCounter.TARGET),
      forSourceLines("DroiduxRootStore_CounterStoreImpl", Source.StoreImpl.COUNTER),
      forSourceLines("DroiduxRootStore", Source.BindableCounter.GENERATED_STORE)
  );
}
origin: izumin5210/Droidux

@Test
public void singleReducer_with_BackpressureStrategySpecification() {
  assertJavaSource(
      forSourceLines("RootStore", Source.CounterWithBackpressureStrategy.TARGET),
      forSourceLines("DroiduxRootStore_CounterStoreImpl", Source.StoreImpl.COUNTER),
      forSourceLines("DroiduxRootStore", Source.CounterWithBackpressureStrategy.GENERATED_STORE)
  );
}
origin: izumin5210/Droidux

@Test
public void singleReducer() {
  assertJavaSource(
      forSourceLines("RootStore", Source.Counter.TARGET),
      forSourceLines("DroiduxRootStore_CounterStoreImpl", Source.StoreImpl.COUNTER),
      forSourceLines("DroiduxRootStore", Source.Counter.GENERATED_STORE)
  );
}
origin: izumin5210/Droidux

@Test
public void reducerWithoutSuffix() {
  expectedException.expect(RuntimeException.class);
  expectedException.expectMessage(
      "@Reducer class name must end with \"Reducer\". \"CounterReduce\" has invalid class name."
  );
  assertJavaSource(
      forSourceLines("CounterStore", Source.ReducerWithoutSuffix.TARGET),
      forSourceLines("DroiduxCounterStore_CounterStoreImpl", Source.EMPTY),
      forSourceLines("DroiduxCounterStore", Source.EMPTY)
  );
}
origin: izumin5210/Droidux

@Test
public void dispatchableMethodReturnsWrongType() {
  expectedException.expect(RuntimeException.class);
  expectedException.expectMessage(
      "@Dispatchable method can have arguments only state or action. "
          + "CounterReducer#increment() has more than one invalid argument."
  );
  assertJavaSource(
      forSourceLines("CounterStore", Source.DispatchableTakesExtraArguments.TARGET),
      forSourceLines("DroiduxCounterStore_CounterStoreImpl", Source.EMPTY),
      forSourceLines("DroiduxCounterStore", Source.EMPTY)
  );
}
origin: izumin5210/Droidux

@Test
public void dispatchableMethodTakesWrongStateType() {
  expectedException.expect(RuntimeException.class);
  expectedException.expectMessage(
      "@Dispatchable method can have arguments only state or action. "
          + "CounterReducer#increment() has more than one invalid argument."
  );
  assertJavaSource(
      forSourceLines("CounterStore", Source.DispatchableTakesWrongStateType.TARGET),
      forSourceLines("DroiduxCounterStore_CounterStoreImpl", Source.EMPTY),
      forSourceLines("DroiduxCounterStore", Source.EMPTY)
  );
}
origin: izumin5210/Droidux

@Test
public void dispatchableMethodTakesWrongActionType() {
  expectedException.expect(RuntimeException.class);
  expectedException.expectMessage(
      "@Dispatchable method can have arguments only state or action. "
          + "TodoListReducer#addItem() has more than one invalid argument."
  );
  assertJavaSource(
      forSourceLines("TodoListStore", Source.DispatchableTakesWrongActionType.TARGET),
      forSourceLines("DroiduxTodoListStore_TodoListStoreImpl", Source.EMPTY),
      forSourceLines("DroiduxTodoListStore", Source.EMPTY)
  );
}
origin: izumin5210/Droidux

  @Test
  public void storeNotExtendBaseStore() {
    expectedException.expect(RuntimeException.class);
    expectedException.expectMessage(
        "The interface that is annotated @Store must extend \"BaseStore\"."
    );
    assertJavaSource(
        forSourceLines("CounterStore", Source.StoreNotExtendsBaseStore.TARGET),
        forSourceLines("DroiduxCounterStore_CounterStoreImpl", Source.EMPTY),
        forSourceLines("DroiduxCounterStore", Source.EMPTY)
    );
  }
}
origin: izumin5210/Droidux

@Test
public void dispatchableMethodShouldReturnState() {
  expectedException.expect(RuntimeException.class);
  expectedException.expectMessage(
      "@Dispatchable method must return new state. "
          + "But CounterReducer#increment() returns invalid type."
  );
  assertJavaSource(
      forSourceLines("CounterStore", Source.DispatchableMethosReturnsWrongType.TARGET),
      forSourceLines("DroiduxCounterStore_CounterStoreImpl", Source.EMPTY),
      forSourceLines("DroiduxCounterStore", Source.EMPTY)
  );
}
origin: izumin5210/Droidux

@Test
public void undoableReducerWithoutUndoableState() {
  expectedException.expect(RuntimeException.class);
  expectedException.expectMessage(
      "@Reducer class annotated with @Undoable must have the state implements \"UndoableState<T>\". "
          + "Counter state of CounterReducer does not implement it."
  );
  assertJavaSource(
      forSourceLines("CounterStore", Source.UndoableReducerWithoutUndoableState.TARGET),
      forSourceLines("DroiduxCounterStore_CounterStoreImpl", Source.EMPTY),
      forSourceLines("DroiduxCounterStore", Source.EMPTY)
  );
}
origin: izumin5210/Droidux

@Test
public void storeHasClassThatIsNotAnnotatedWithReducer() {
  expectedException.expect(RuntimeException.class);
  expectedException.expectMessage(
      "Values of @Store annotation must have only classes annotated with \"@Reducer\"."
          + "But CounterStore has invalid value."
  );
  assertJavaSource(
      forSourceLines("CounterStore", Source.StoreHasInvalidValue.TARGET),
      forSourceLines("DroiduxCounterStore_CounterStoreImpl", Source.EMPTY),
      forSourceLines("DroiduxCounterStore", Source.EMPTY)
  );
}
origin: Wokdsem/Kinject

private void assertCompileFail(String fullQualifiedName, String module) {
  assert_().about(javaSource())
      .that(JavaFileObjects.forSourceLines(fullQualifiedName, module))
      .processedWith(new ModuleProcessor())
      .failsToCompile();
}
origin: yongjhih/RetroFacebook

public void testAnnotationOnInterface() throws Exception {
 JavaFileObject javaFileObject = JavaFileObjects.forSourceLines(
   "foo.bar.Baz",
   "package foo.bar;",
   "",
   "import retrofacebook.RetroFacebook;",
   "",
   "@RetroFacebook",
   "public interface Baz {}");
 assertAbout(javaSource())
   .that(javaFileObject)
   .processedWith(new RetroFacebookProcessor())
   .failsToCompile()
   .withErrorContaining("RetroFacebook only applies to classes")
   .in(javaFileObject).onLine(6);
}
com.google.testing.compileJavaFileObjectsforSourceLines

Javadoc

An overload of #forSourceLines that takes an Iterable.

Popular methods of JavaFileObjects

  • forSourceString
    Creates a JavaFileObject with a path corresponding to the fullyQualifiedNamecontaining the give sour
  • forResource
    Returns a JavaFileObject for the resource at the given URL. The returned object will always be read-
  • asByteSource
  • deduceKind

Popular in Java

  • Start an intent from android
  • getExternalFilesDir (Context)
  • getSystemService (Context)
  • getSharedPreferences (Context)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Collectors (java.util.stream)
  • Get (org.apache.hadoop.hbase.client)
    Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now