Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2014 Objectos, Fábrica de Software LTDA.
  *
  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  * use this file except in compliance with the License. You may obtain a copy of
  * the License at
  *
  * http://www.apache.org/licenses/LICENSE-2.0
  *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package br.com.objectos.way.auto.optional;

Author(s):
marcio.endo@objectos.com.br (Marcio Endo)
public class AutoOptionalProcessorTest {
  public void optional_test_0() {
    ..about(JavaSourcesSubjectFactory.javaSources())
        .that(forResource("code/way-auto-optional/OptionalTest0.java"))
        .processedWith(new AutoOptionalProcessor())
        .compilesWithoutError()
        .and().generatesSources(
            forSourceCode("OptionalTest0Pojo""OptionalTest0Pojo.java"),
            forSourceCode("OptionalTest0Builder""OptionalTest0Builder.java"),
            forSourceCode("OptionalTest0BuilderPojo""OptionalTest0BuilderPojo.java"));
  }
  public void optional_test_1() {
    ..about(JavaSourcesSubjectFactory.javaSources())
        .that(forResource("code/way-auto-optional/OptionalTest1.java"))
        .processedWith(new AutoOptionalProcessor())
        .compilesWithoutError()
        .and().generatesSources(
            forSourceCode("OptionalTest1Pojo""OptionalTest1Pojo.java"),
            forSourceCode("OptionalTest1Builder""OptionalTest1Builder.java"),
            forSourceCode("OptionalTest1BuilderPojo""OptionalTest1BuilderPojo.java"));
  }
  private Iterable<? extends JavaFileObjectforResource(String... paths) {
    return WayIterables.from(paths)
        .toImmutableList();
  }
  private JavaFileObject forSourceCode(String nameString path) {
    String source = WayAsserts.contentsOf("/code/way-auto-optional/" + path);
    String qname = "br.com.objectos.way.auto.core.fakes." + name;
    return JavaFileObjects.forSourceString(qnamesource);
  }
  private static enum PathToJavaFileObject implements Function<StringJavaFileObject> {
    INSTANCE;
    @Override
    public JavaFileObject apply(String input) {
      return JavaFileObjects.forResource(input);
    }
  }
New to GrepCode? Check out our FAQ X