target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test public void canAssignStaticMethodResult() { TypeElement immutableMap = elementUtils.getTypeElement(ImmutableMap.class.getCanonicalName()); TypeElement string = elementUtils.getTypeElement(String.class.getCanonicalName()); TypeElement integer = elementUtils.getTypeElement(Integer.class.getCanonicalName()); TypeEle... | static boolean canAssignStaticMethodResult( ExecutableElement method, TypeMirror actualParameterType, TypeMirror targetType, Types typeUtils) { if (!targetType.getKind().equals(TypeKind.DECLARED) || !method.getModifiers().contains(Modifier.STATIC) || method.getParameters().size() != 1) { return false; } List<? extends ... | TypeVariables { static boolean canAssignStaticMethodResult( ExecutableElement method, TypeMirror actualParameterType, TypeMirror targetType, Types typeUtils) { if (!targetType.getKind().equals(TypeKind.DECLARED) || !method.getModifiers().contains(Modifier.STATIC) || method.getParameters().size() != 1) { return false; }... | TypeVariables { static boolean canAssignStaticMethodResult( ExecutableElement method, TypeMirror actualParameterType, TypeMirror targetType, Types typeUtils) { if (!targetType.getKind().equals(TypeKind.DECLARED) || !method.getModifiers().contains(Modifier.STATIC) || method.getParameters().size() != 1) { return false; }... | TypeVariables { static boolean canAssignStaticMethodResult( ExecutableElement method, TypeMirror actualParameterType, TypeMirror targetType, Types typeUtils) { if (!targetType.getKind().equals(TypeKind.DECLARED) || !method.getModifiers().contains(Modifier.STATIC) || method.getParameters().size() != 1) { return false; }... | TypeVariables { static boolean canAssignStaticMethodResult( ExecutableElement method, TypeMirror actualParameterType, TypeMirror targetType, Types typeUtils) { if (!targetType.getKind().equals(TypeKind.DECLARED) || !method.getModifiers().contains(Modifier.STATIC) || method.getParameters().size() != 1) { return false; }... |
@Test public void decapitalizeLikeJavaBeans() { NORMAL_CASES .forEach( (input, output) -> { expect.that(PropertyNames.decapitalizeLikeJavaBeans(input)).isEqualTo(output); }); expect.that(PropertyNames.decapitalizeLikeJavaBeans(null)).isNull(); expect.that(PropertyNames.decapitalizeLikeJavaBeans("HTMLPage")).isEqualTo("... | static String decapitalizeLikeJavaBeans(String propertyName) { if (propertyName != null && propertyName.length() >= 2 && Character.isUpperCase(propertyName.charAt(0)) && Character.isUpperCase(propertyName.charAt(1))) { return propertyName; } return decapitalizeNormally(propertyName); } | PropertyNames { static String decapitalizeLikeJavaBeans(String propertyName) { if (propertyName != null && propertyName.length() >= 2 && Character.isUpperCase(propertyName.charAt(0)) && Character.isUpperCase(propertyName.charAt(1))) { return propertyName; } return decapitalizeNormally(propertyName); } } | PropertyNames { static String decapitalizeLikeJavaBeans(String propertyName) { if (propertyName != null && propertyName.length() >= 2 && Character.isUpperCase(propertyName.charAt(0)) && Character.isUpperCase(propertyName.charAt(1))) { return propertyName; } return decapitalizeNormally(propertyName); } } | PropertyNames { static String decapitalizeLikeJavaBeans(String propertyName) { if (propertyName != null && propertyName.length() >= 2 && Character.isUpperCase(propertyName.charAt(0)) && Character.isUpperCase(propertyName.charAt(1))) { return propertyName; } return decapitalizeNormally(propertyName); } } | PropertyNames { static String decapitalizeLikeJavaBeans(String propertyName) { if (propertyName != null && propertyName.length() >= 2 && Character.isUpperCase(propertyName.charAt(0)) && Character.isUpperCase(propertyName.charAt(1))) { return propertyName; } return decapitalizeNormally(propertyName); } } |
@Test public void decapitalizeNormally() { NORMAL_CASES .forEach( (input, output) -> { expect.that(PropertyNames.decapitalizeNormally(input)).isEqualTo(output); }); expect.that(PropertyNames.decapitalizeNormally(null)).isNull(); expect.that(PropertyNames.decapitalizeNormally("HTMLPage")).isEqualTo("hTMLPage"); expect.t... | static String decapitalizeNormally(String propertyName) { if (Strings.isNullOrEmpty(propertyName)) { return propertyName; } return Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1); } | PropertyNames { static String decapitalizeNormally(String propertyName) { if (Strings.isNullOrEmpty(propertyName)) { return propertyName; } return Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1); } } | PropertyNames { static String decapitalizeNormally(String propertyName) { if (Strings.isNullOrEmpty(propertyName)) { return propertyName; } return Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1); } } | PropertyNames { static String decapitalizeNormally(String propertyName) { if (Strings.isNullOrEmpty(propertyName)) { return propertyName; } return Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1); } } | PropertyNames { static String decapitalizeNormally(String propertyName) { if (Strings.isNullOrEmpty(propertyName)) { return propertyName; } return Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1); } } |
@Test public void testPackageNameOfString() { assertThat(TypeSimplifier.packageNameOf(typeElementOf(java.lang.String.class))) .isEqualTo("java.lang"); } | static String packageNameOf(TypeElement type) { return MoreElements.getPackage(type).getQualifiedName().toString(); } | TypeSimplifier { static String packageNameOf(TypeElement type) { return MoreElements.getPackage(type).getQualifiedName().toString(); } } | TypeSimplifier { static String packageNameOf(TypeElement type) { return MoreElements.getPackage(type).getQualifiedName().toString(); } TypeSimplifier(
Elements elementUtils,
Types typeUtils,
String packageName,
Set<TypeMirror> types,
TypeMirror base); } | TypeSimplifier { static String packageNameOf(TypeElement type) { return MoreElements.getPackage(type).getQualifiedName().toString(); } TypeSimplifier(
Elements elementUtils,
Types typeUtils,
String packageName,
Set<TypeMirror> types,
TypeMirror base); } | TypeSimplifier { static String packageNameOf(TypeElement type) { return MoreElements.getPackage(type).getQualifiedName().toString(); } TypeSimplifier(
Elements elementUtils,
Types typeUtils,
String packageName,
Set<TypeMirror> types,
TypeMirror base); } |
@Test public void testPackageNameOfMapEntry() { assertThat(TypeSimplifier.packageNameOf(typeElementOf(java.util.Map.Entry.class))) .isEqualTo("java.util"); } | static String packageNameOf(TypeElement type) { return MoreElements.getPackage(type).getQualifiedName().toString(); } | TypeSimplifier { static String packageNameOf(TypeElement type) { return MoreElements.getPackage(type).getQualifiedName().toString(); } } | TypeSimplifier { static String packageNameOf(TypeElement type) { return MoreElements.getPackage(type).getQualifiedName().toString(); } TypeSimplifier(
Elements elementUtils,
Types typeUtils,
String packageName,
Set<TypeMirror> types,
TypeMirror base); } | TypeSimplifier { static String packageNameOf(TypeElement type) { return MoreElements.getPackage(type).getQualifiedName().toString(); } TypeSimplifier(
Elements elementUtils,
Types typeUtils,
String packageName,
Set<TypeMirror> types,
TypeMirror base); } | TypeSimplifier { static String packageNameOf(TypeElement type) { return MoreElements.getPackage(type).getQualifiedName().toString(); } TypeSimplifier(
Elements elementUtils,
Types typeUtils,
String packageName,
Set<TypeMirror> types,
TypeMirror base); } |
@Test public void testIsCastingUnchecked() { TypeElement erasureClass = typeElementOf(Erasure.class); List<VariableElement> fields = ElementFilter.fieldsIn(erasureClass.getEnclosedElements()); assertThat(fields).isNotEmpty(); for (VariableElement field : fields) { String fieldName = field.getSimpleName().toString(); bo... | static boolean isCastingUnchecked(TypeMirror type) { return CASTING_UNCHECKED_VISITOR.visit(type, null); } | TypeSimplifier { static boolean isCastingUnchecked(TypeMirror type) { return CASTING_UNCHECKED_VISITOR.visit(type, null); } } | TypeSimplifier { static boolean isCastingUnchecked(TypeMirror type) { return CASTING_UNCHECKED_VISITOR.visit(type, null); } TypeSimplifier(
Elements elementUtils,
Types typeUtils,
String packageName,
Set<TypeMirror> types,
TypeMirror base); } | TypeSimplifier { static boolean isCastingUnchecked(TypeMirror type) { return CASTING_UNCHECKED_VISITOR.visit(type, null); } TypeSimplifier(
Elements elementUtils,
Types typeUtils,
String packageName,
Set<TypeMirror> types,
TypeMirror base); } | TypeSimplifier { static boolean isCastingUnchecked(TypeMirror type) { return CASTING_UNCHECKED_VISITOR.visit(type, null); } TypeSimplifier(
Elements elementUtils,
Types typeUtils,
String packageName,
Set<TypeMirror> types,
TypeMirror base); } |
@Test public void proxyFieldType() { TypeMirror typeMirror = declaredTypeOf(ImmutableList.class, Integer.class); Serializer serializer = extension.getSerializer(typeMirror, fakeSerializerFactory, mockProcessingEnvironment).get(); TypeMirror actualTypeMirror = serializer.proxyFieldType(); assertThat(typeUtils.isSameType... | @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Serializer containedTypeSerializer = factory.getSerializer... | ImmutableListSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeM... | ImmutableListSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeM... | ImmutableListSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeM... | ImmutableListSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeM... |
@Test public void testNestedValueType() { ImmutableMap<Integer, String> numberNames = ImmutableMap.of(1, "un", 2, "deux"); NestedValueType.Nested nested = NestedValueType.Nested.create(numberNames); assertEquals(numberNames, nested.numberNames()); } | public static SimpleValueType create( @Nullable String string, int integer, Map<String, Long> map) { return new AutoValue_SimpleValueType(string, integer, map); } | SimpleValueType { public static SimpleValueType create( @Nullable String string, int integer, Map<String, Long> map) { return new AutoValue_SimpleValueType(string, integer, map); } } | SimpleValueType { public static SimpleValueType create( @Nullable String string, int integer, Map<String, Long> map) { return new AutoValue_SimpleValueType(string, integer, map); } } | SimpleValueType { public static SimpleValueType create( @Nullable String string, int integer, Map<String, Long> map) { return new AutoValue_SimpleValueType(string, integer, map); } @Nullable abstract String string(); abstract int integer(); abstract Map<String, Long> map(); static SimpleValueType create(
@Nullab... | SimpleValueType { public static SimpleValueType create( @Nullable String string, int integer, Map<String, Long> map) { return new AutoValue_SimpleValueType(string, integer, map); } @Nullable abstract String string(); abstract int integer(); abstract Map<String, Long> map(); static SimpleValueType create(
@Nullab... |
@Test public void testNestedValueType() { ImmutableMap<Integer, String> numberNames = ImmutableMap.of(1, "un", 2, "deux"); PackagelessNestedValueType.Nested nested = PackagelessNestedValueType.Nested.create(numberNames); assertEquals(numberNames, nested.numberNames()); } | public static PackagelessValueType create( @Nullable String string, int integer, Map<String, Long> map) { return new AutoValue_PackagelessValueType(string, integer, map); } | PackagelessValueType { public static PackagelessValueType create( @Nullable String string, int integer, Map<String, Long> map) { return new AutoValue_PackagelessValueType(string, integer, map); } } | PackagelessValueType { public static PackagelessValueType create( @Nullable String string, int integer, Map<String, Long> map) { return new AutoValue_PackagelessValueType(string, integer, map); } } | PackagelessValueType { public static PackagelessValueType create( @Nullable String string, int integer, Map<String, Long> map) { return new AutoValue_PackagelessValueType(string, integer, map); } @Nullable abstract String string(); abstract int integer(); abstract Map<String, Long> map(); static PackagelessValueType c... | PackagelessValueType { public static PackagelessValueType create( @Nullable String string, int integer, Map<String, Long> map) { return new AutoValue_PackagelessValueType(string, integer, map); } @Nullable abstract String string(); abstract int integer(); abstract Map<String, Long> map(); static PackagelessValueType c... |
@Test public void missingReturnType() { JavaFileObject javaFileObject = JavaFileObjects.forSourceLines( "test.TestClass", "package test;", "", "abstract class TestClass {", " abstract MissingType blah();", "}"); assertAbout(javaSource()) .that(javaFileObject) .processedWith(new AssertingProcessor() { @Override void run... | public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... |
@Test public void missingGenericReturnType() { JavaFileObject javaFileObject = JavaFileObjects.forSourceLines( "test.TestClass", "package test;", "", "abstract class TestClass {", " abstract MissingType<?> blah();", "}"); assertAbout(javaSource()) .that(javaFileObject) .processedWith(new AssertingProcessor() { @Overrid... | public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... |
@Test public void missingReturnTypeTypeParameter() { JavaFileObject javaFileObject = JavaFileObjects.forSourceLines( "test.TestClass", "package test;", "", "import java.util.Map;", "import java.util.Set;", "", "abstract class TestClass {", " abstract Map<Set<?>, MissingType<?>> blah();", "}"); assertAbout(javaSource())... | public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... |
@Test public void missingTypeParameter() { JavaFileObject javaFileObject = JavaFileObjects.forSourceLines( "test.TestClass", "package test;", "", "class TestClass<T extends MissingType> {}"); assertAbout(javaSource()) .that(javaFileObject) .processedWith(new AssertingProcessor() { @Override void runAssertions() { TypeE... | public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... |
@Test public void missingParameterType() { JavaFileObject javaFileObject = JavaFileObjects.forSourceLines( "test.TestClass", "package test;", "", "abstract class TestClass {", " abstract void foo(MissingType x);", "}"); assertAbout(javaSource()) .that(javaFileObject) .processedWith(new AssertingProcessor() { @Override ... | public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... |
@Test public void missingAnnotation() { JavaFileObject javaFileObject = JavaFileObjects.forSourceLines( "test.TestClass", "package test;", "", "@MissingAnnotation", "class TestClass {}"); assertAbout(javaSource()) .that(javaFileObject) .processedWith(new AssertingProcessor() { @Override void runAssertions() { TypeEleme... | public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... |
@Test public void handlesRecursiveTypeParams() { JavaFileObject javaFileObject = JavaFileObjects.forSourceLines( "test.TestClass", "package test;", "", "class TestClass<T extends Comparable<T>> {}"); assertAbout(javaSource()) .that(javaFileObject) .processedWith(new AssertingProcessor() { @Override void runAssertions()... | public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... |
@Test public void handlesRecursiveType() { JavaFileObject javaFileObject = JavaFileObjects.forSourceLines( "test.TestClass", "package test;", "", "abstract class TestClass {", " abstract TestClass foo(TestClass x);", "}"); assertAbout(javaSource()) .that(javaFileObject) .processedWith(new AssertingProcessor() { @Overri... | public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... |
@Test public void toProxy() { TypeMirror typeMirror = declaredTypeOf(ImmutableList.class, Integer.class); Serializer serializer = extension.getSerializer(typeMirror, fakeSerializerFactory, mockProcessingEnvironment).get(); CodeBlock actualCodeBlock = serializer.toProxy(CodeBlock.of("x")); assertThat(actualCodeBlock.toS... | @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Serializer containedTypeSerializer = factory.getSerializer... | ImmutableListSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeM... | ImmutableListSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeM... | ImmutableListSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeM... | ImmutableListSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeM... |
@Test public void missingWildcardBound() { JavaFileObject javaFileObject = JavaFileObjects.forSourceLines( "test.TestClass", "package test;", "", "import java.util.Set;", "", "class TestClass {", " Set<? extends MissingType> extendsTest() {", " return null;", " }", "", " Set<? super MissingType> superTest() {", " retur... | public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... |
@Test public void missingIntersection() { JavaFileObject javaFileObject = JavaFileObjects.forSourceLines( "test.TestClass", "package test;", "", "class TestClass<T extends Number & Missing> {}"); assertAbout(javaSource()) .that(javaFileObject) .processedWith(new AssertingProcessor() { @Override void runAssertions() { T... | public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... |
@Test public void invalidAnnotationValue() { JavaFileObject javaFileObject = JavaFileObjects.forSourceLines("test.Outer", "package test;", "", "final class Outer {", " @interface TestAnnotation {", " Class[] classes();", " }", "", " @TestAnnotation(classes = Foo)", " static class TestClass {}", "}"); assertAbout(javaSo... | public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); } | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... | SuperficialValidation { public static boolean validateElement(Element element) { return element.accept(ELEMENT_VALIDATING_VISITOR, null); } private SuperficialValidation(); static boolean validateElements(Iterable<? extends Element> elements); static boolean validateElement(Element element); static boolean validateTyp... |
@Test public void processingStepAsStepAnnotationsNamesMatchClasses() { Step step = BasicAnnotationProcessor.asStep(new MultiAnnotationProcessingStep()); assertThat(step.annotations()) .containsExactly( AnAnnotation.class.getCanonicalName(), ReferencesAClass.class.getCanonicalName()); } | protected static Step asStep(ProcessingStep processingStep) { return new ProcessingStepAsStep(processingStep); } | BasicAnnotationProcessor extends AbstractProcessor { protected static Step asStep(ProcessingStep processingStep) { return new ProcessingStepAsStep(processingStep); } } | BasicAnnotationProcessor extends AbstractProcessor { protected static Step asStep(ProcessingStep processingStep) { return new ProcessingStepAsStep(processingStep); } } | BasicAnnotationProcessor extends AbstractProcessor { protected static Step asStep(ProcessingStep processingStep) { return new ProcessingStepAsStep(processingStep); } @Override final synchronized void init(ProcessingEnvironment processingEnv); @Override final ImmutableSet<String> getSupportedAnnotationTypes(); @Overrid... | BasicAnnotationProcessor extends AbstractProcessor { protected static Step asStep(ProcessingStep processingStep) { return new ProcessingStepAsStep(processingStep); } @Override final synchronized void init(ProcessingEnvironment processingEnv); @Override final ImmutableSet<String> getSupportedAnnotationTypes(); @Overrid... |
@Test public void getPackage() { assertThat(MoreElements.getPackage(stringElement)).isEqualTo(javaLangPackageElement); for (Element childElement : stringElement.getEnclosedElements()) { assertThat(MoreElements.getPackage(childElement)).isEqualTo(javaLangPackageElement); } } | public static PackageElement getPackage(Element element) { while (element.getKind() != PACKAGE) { element = element.getEnclosingElement(); } return (PackageElement) element; } | MoreElements { public static PackageElement getPackage(Element element) { while (element.getKind() != PACKAGE) { element = element.getEnclosingElement(); } return (PackageElement) element; } } | MoreElements { public static PackageElement getPackage(Element element) { while (element.getKind() != PACKAGE) { element = element.getEnclosingElement(); } return (PackageElement) element; } private MoreElements(); } | MoreElements { public static PackageElement getPackage(Element element) { while (element.getKind() != PACKAGE) { element = element.getEnclosingElement(); } return (PackageElement) element; } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); sta... | MoreElements { public static PackageElement getPackage(Element element) { while (element.getKind() != PACKAGE) { element = element.getEnclosingElement(); } return (PackageElement) element; } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); sta... |
@Test public void asPackage() { assertThat(MoreElements.asPackage(javaLangPackageElement)) .isEqualTo(javaLangPackageElement); } | public static PackageElement asPackage(Element element) { return element.accept(PackageElementVisitor.INSTANCE, null); } | MoreElements { public static PackageElement asPackage(Element element) { return element.accept(PackageElementVisitor.INSTANCE, null); } } | MoreElements { public static PackageElement asPackage(Element element) { return element.accept(PackageElementVisitor.INSTANCE, null); } private MoreElements(); } | MoreElements { public static PackageElement asPackage(Element element) { return element.accept(PackageElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static TypeElement... | MoreElements { public static PackageElement asPackage(Element element) { return element.accept(PackageElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static TypeElement... |
@Test public void asPackage_illegalArgument() { try { MoreElements.asPackage(stringElement); fail(); } catch (IllegalArgumentException expected) {} } | public static PackageElement asPackage(Element element) { return element.accept(PackageElementVisitor.INSTANCE, null); } | MoreElements { public static PackageElement asPackage(Element element) { return element.accept(PackageElementVisitor.INSTANCE, null); } } | MoreElements { public static PackageElement asPackage(Element element) { return element.accept(PackageElementVisitor.INSTANCE, null); } private MoreElements(); } | MoreElements { public static PackageElement asPackage(Element element) { return element.accept(PackageElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static TypeElement... | MoreElements { public static PackageElement asPackage(Element element) { return element.accept(PackageElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static TypeElement... |
@Test public void asTypeParameterElement() { Element typeParameterElement = getOnlyElement( compilation .getElements() .getTypeElement(List.class.getCanonicalName()) .getTypeParameters()); assertThat(MoreElements.asTypeParameter(typeParameterElement)).isEqualTo(typeParameterElement); } | public static TypeParameterElement asTypeParameter(Element element) { return element.accept(TypeParameterElementVisitor.INSTANCE, null); } | MoreElements { public static TypeParameterElement asTypeParameter(Element element) { return element.accept(TypeParameterElementVisitor.INSTANCE, null); } } | MoreElements { public static TypeParameterElement asTypeParameter(Element element) { return element.accept(TypeParameterElementVisitor.INSTANCE, null); } private MoreElements(); } | MoreElements { public static TypeParameterElement asTypeParameter(Element element) { return element.accept(TypeParameterElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); ... | MoreElements { public static TypeParameterElement asTypeParameter(Element element) { return element.accept(TypeParameterElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); ... |
@Test public void asTypeParameterElement_illegalArgument() { try { MoreElements.asTypeParameter(javaLangPackageElement); fail(); } catch (IllegalArgumentException expected) { } } | public static TypeParameterElement asTypeParameter(Element element) { return element.accept(TypeParameterElementVisitor.INSTANCE, null); } | MoreElements { public static TypeParameterElement asTypeParameter(Element element) { return element.accept(TypeParameterElementVisitor.INSTANCE, null); } } | MoreElements { public static TypeParameterElement asTypeParameter(Element element) { return element.accept(TypeParameterElementVisitor.INSTANCE, null); } private MoreElements(); } | MoreElements { public static TypeParameterElement asTypeParameter(Element element) { return element.accept(TypeParameterElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); ... | MoreElements { public static TypeParameterElement asTypeParameter(Element element) { return element.accept(TypeParameterElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); ... |
@Test public void asType() { assertThat(MoreElements.asType(stringElement)).isEqualTo(stringElement); } | public static TypeElement asType(Element element) { return element.accept(TypeElementVisitor.INSTANCE, null); } | MoreElements { public static TypeElement asType(Element element) { return element.accept(TypeElementVisitor.INSTANCE, null); } } | MoreElements { public static TypeElement asType(Element element) { return element.accept(TypeElementVisitor.INSTANCE, null); } private MoreElements(); } | MoreElements { public static TypeElement asType(Element element) { return element.accept(TypeElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static TypeElement asType(E... | MoreElements { public static TypeElement asType(Element element) { return element.accept(TypeElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static TypeElement asType(E... |
@Test public void fromProxy() { TypeMirror typeMirror = declaredTypeOf(ImmutableList.class, Integer.class); Serializer serializer = extension.getSerializer(typeMirror, fakeSerializerFactory, mockProcessingEnvironment).get(); CodeBlock actualCodeBlock = serializer.fromProxy(CodeBlock.of("x")); assertThat(actualCodeBlock... | @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Serializer containedTypeSerializer = factory.getSerializer... | ImmutableListSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeM... | ImmutableListSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeM... | ImmutableListSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeM... | ImmutableListSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isImmutableList(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeM... |
@Test public void asVariable() { for (Element variableElement : ElementFilter.fieldsIn(stringElement.getEnclosedElements())) { assertThat(MoreElements.asVariable(variableElement)).isEqualTo(variableElement); } } | public static VariableElement asVariable(Element element) { return element.accept(VariableElementVisitor.INSTANCE, null); } | MoreElements { public static VariableElement asVariable(Element element) { return element.accept(VariableElementVisitor.INSTANCE, null); } } | MoreElements { public static VariableElement asVariable(Element element) { return element.accept(VariableElementVisitor.INSTANCE, null); } private MoreElements(); } | MoreElements { public static VariableElement asVariable(Element element) { return element.accept(VariableElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static TypeElem... | MoreElements { public static VariableElement asVariable(Element element) { return element.accept(VariableElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static TypeElem... |
@Test public void asVariable_illegalArgument() { try { MoreElements.asVariable(javaLangPackageElement); fail(); } catch (IllegalArgumentException expected) {} } | public static VariableElement asVariable(Element element) { return element.accept(VariableElementVisitor.INSTANCE, null); } | MoreElements { public static VariableElement asVariable(Element element) { return element.accept(VariableElementVisitor.INSTANCE, null); } } | MoreElements { public static VariableElement asVariable(Element element) { return element.accept(VariableElementVisitor.INSTANCE, null); } private MoreElements(); } | MoreElements { public static VariableElement asVariable(Element element) { return element.accept(VariableElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static TypeElem... | MoreElements { public static VariableElement asVariable(Element element) { return element.accept(VariableElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static TypeElem... |
@Test public void asExecutable() { for (Element methodElement : ElementFilter.methodsIn(stringElement.getEnclosedElements())) { assertThat(MoreElements.asExecutable(methodElement)).isEqualTo(methodElement); } for (Element methodElement : ElementFilter.constructorsIn(stringElement.getEnclosedElements())) { assertThat(Mo... | public static ExecutableElement asExecutable(Element element) { return element.accept(ExecutableElementVisitor.INSTANCE, null); } | MoreElements { public static ExecutableElement asExecutable(Element element) { return element.accept(ExecutableElementVisitor.INSTANCE, null); } } | MoreElements { public static ExecutableElement asExecutable(Element element) { return element.accept(ExecutableElementVisitor.INSTANCE, null); } private MoreElements(); } | MoreElements { public static ExecutableElement asExecutable(Element element) { return element.accept(ExecutableElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static Ty... | MoreElements { public static ExecutableElement asExecutable(Element element) { return element.accept(ExecutableElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static Ty... |
@Test public void asExecutable_illegalArgument() { try { MoreElements.asExecutable(javaLangPackageElement); fail(); } catch (IllegalArgumentException expected) {} } | public static ExecutableElement asExecutable(Element element) { return element.accept(ExecutableElementVisitor.INSTANCE, null); } | MoreElements { public static ExecutableElement asExecutable(Element element) { return element.accept(ExecutableElementVisitor.INSTANCE, null); } } | MoreElements { public static ExecutableElement asExecutable(Element element) { return element.accept(ExecutableElementVisitor.INSTANCE, null); } private MoreElements(); } | MoreElements { public static ExecutableElement asExecutable(Element element) { return element.accept(ExecutableElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static Ty... | MoreElements { public static ExecutableElement asExecutable(Element element) { return element.accept(ExecutableElementVisitor.INSTANCE, null); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); static boolean isType(Element element); static Ty... |
@Test public void isAnnotationPresent() { TypeElement annotatedAnnotationElement = compilation.getElements().getTypeElement(AnnotatedAnnotation.class.getCanonicalName()); assertThat(MoreElements.isAnnotationPresent(annotatedAnnotationElement, Documented.class)) .isTrue(); assertThat(MoreElements.isAnnotationPresent(ann... | public static boolean isAnnotationPresent(Element element, Class<? extends Annotation> annotationClass) { return getAnnotationMirror(element, annotationClass).isPresent(); } | MoreElements { public static boolean isAnnotationPresent(Element element, Class<? extends Annotation> annotationClass) { return getAnnotationMirror(element, annotationClass).isPresent(); } } | MoreElements { public static boolean isAnnotationPresent(Element element, Class<? extends Annotation> annotationClass) { return getAnnotationMirror(element, annotationClass).isPresent(); } private MoreElements(); } | MoreElements { public static boolean isAnnotationPresent(Element element, Class<? extends Annotation> annotationClass) { return getAnnotationMirror(element, annotationClass).isPresent(); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); stati... | MoreElements { public static boolean isAnnotationPresent(Element element, Class<? extends Annotation> annotationClass) { return getAnnotationMirror(element, annotationClass).isPresent(); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element element); stati... |
@Test public void getAnnotationMirror() { TypeElement element = compilation.getElements().getTypeElement(AnnotatedAnnotation.class.getCanonicalName()); Optional<AnnotationMirror> documented = MoreElements.getAnnotationMirror(element, Documented.class); Optional<AnnotationMirror> innerAnnotation = MoreElements.getAnnota... | public static Optional<AnnotationMirror> getAnnotationMirror(Element element, Class<? extends Annotation> annotationClass) { String annotationClassName = annotationClass.getCanonicalName(); for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) { TypeElement annotationTypeElement = asType(annotationMi... | MoreElements { public static Optional<AnnotationMirror> getAnnotationMirror(Element element, Class<? extends Annotation> annotationClass) { String annotationClassName = annotationClass.getCanonicalName(); for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) { TypeElement annotationTypeElement = asTy... | MoreElements { public static Optional<AnnotationMirror> getAnnotationMirror(Element element, Class<? extends Annotation> annotationClass) { String annotationClassName = annotationClass.getCanonicalName(); for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) { TypeElement annotationTypeElement = asTy... | MoreElements { public static Optional<AnnotationMirror> getAnnotationMirror(Element element, Class<? extends Annotation> annotationClass) { String annotationClassName = annotationClass.getCanonicalName(); for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) { TypeElement annotationTypeElement = asTy... | MoreElements { public static Optional<AnnotationMirror> getAnnotationMirror(Element element, Class<? extends Annotation> annotationClass) { String annotationClassName = annotationClass.getCanonicalName(); for (AnnotationMirror annotationMirror : element.getAnnotationMirrors()) { TypeElement annotationTypeElement = asTy... |
@Test public void getLocalAndInheritedMethods_Old() { Elements elements = compilation.getElements(); Types types = compilation.getTypes(); TypeMirror intMirror = types.getPrimitiveType(TypeKind.INT); TypeMirror longMirror = types.getPrimitiveType(TypeKind.LONG); TypeElement childType = elements.getTypeElement(Child.cla... | @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } } | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } private MoreElements(); } | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } private MoreElements(); static PackageElement getPac... | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } private MoreElements(); static PackageElement getPac... |
@Test public void getLocalAndInheritedMethods() { Elements elements = compilation.getElements(); Types types = compilation.getTypes(); TypeMirror intMirror = types.getPrimitiveType(TypeKind.INT); TypeMirror longMirror = types.getPrimitiveType(TypeKind.LONG); TypeElement childType = elements.getTypeElement(Child.class.g... | @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } } | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } private MoreElements(); } | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } private MoreElements(); static PackageElement getPac... | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } private MoreElements(); static PackageElement getPac... |
@Test public void getAllMethods() { Elements elements = compilation.getElements(); Types types = compilation.getTypes(); TypeMirror intMirror = types.getPrimitiveType(TypeKind.INT); TypeMirror longMirror = types.getPrimitiveType(TypeKind.LONG); TypeElement childType = elements.getTypeElement(Child.class.getCanonicalNam... | public static ImmutableSet<ExecutableElement> getAllMethods( TypeElement type, Types typeUtils, Elements elementUtils) { return getAllMethods(type, new ExplicitOverrides(typeUtils)); } | MoreElements { public static ImmutableSet<ExecutableElement> getAllMethods( TypeElement type, Types typeUtils, Elements elementUtils) { return getAllMethods(type, new ExplicitOverrides(typeUtils)); } } | MoreElements { public static ImmutableSet<ExecutableElement> getAllMethods( TypeElement type, Types typeUtils, Elements elementUtils) { return getAllMethods(type, new ExplicitOverrides(typeUtils)); } private MoreElements(); } | MoreElements { public static ImmutableSet<ExecutableElement> getAllMethods( TypeElement type, Types typeUtils, Elements elementUtils) { return getAllMethods(type, new ExplicitOverrides(typeUtils)); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element elem... | MoreElements { public static ImmutableSet<ExecutableElement> getAllMethods( TypeElement type, Types typeUtils, Elements elementUtils) { return getAllMethods(type, new ExplicitOverrides(typeUtils)); } private MoreElements(); static PackageElement getPackage(Element element); static PackageElement asPackage(Element elem... |
@Test public void getLocalAndInheritedMethods_DaggerBug() { Elements elementUtils = compilation.getElements(); TypeElement main = elementUtils.getTypeElement(Main.ParentComponent.class.getCanonicalName()); Set<ExecutableElement> methods = MoreElements.getLocalAndInheritedMethods( main, compilation.getTypes(), elementUt... | @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } } | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } private MoreElements(); } | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } private MoreElements(); static PackageElement getPac... | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } private MoreElements(); static PackageElement getPac... |
@Test public void getSerializer_nonOptional_emptyReturned() { TypeMirror typeMirror = typeMirrorOf(String.class); Optional<Serializer> actualSerializer = extension.getSerializer(typeMirror, fakeSerializerFactory, mockProcessingEnvironment); assertThat(actualSerializer).isEmpty(); } | @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Serializer containedTypeSerializer = factory.getSerializer(cont... | OptionalSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Se... | OptionalSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Se... | OptionalSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Se... | OptionalSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Se... |
@Test public void getLocalAndInheritedMethods_AbstractList() { Elements elements = compilation.getElements(); TypeElement abstractType = elements.getTypeElement(AbstractAbstractList.class.getCanonicalName()); Set<ExecutableElement> abstractTypeMethods = MoreElements.getLocalAndInheritedMethods(abstractType, elements); ... | @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } } | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } private MoreElements(); } | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } private MoreElements(); static PackageElement getPac... | MoreElements { @Deprecated public static ImmutableSet<ExecutableElement> getLocalAndInheritedMethods( TypeElement type, Elements elementUtils) { Overrides overrides = new Overrides.NativeOverrides(elementUtils); return getLocalAndInheritedMethods(type, overrides); } private MoreElements(); static PackageElement getPac... |
@Test public void equivalence() { Types types = compilationRule.getTypes(); Elements elements = compilationRule.getElements(); TypeMirror objectType = elements.getTypeElement(Object.class.getCanonicalName()).asType(); TypeMirror stringType = elements.getTypeElement(String.class.getCanonicalName()).asType(); TypeElement... | public static Equivalence<TypeMirror> equivalence() { return TypeEquivalence.INSTANCE; } | MoreTypes { public static Equivalence<TypeMirror> equivalence() { return TypeEquivalence.INSTANCE; } } | MoreTypes { public static Equivalence<TypeMirror> equivalence() { return TypeEquivalence.INSTANCE; } private MoreTypes(); } | MoreTypes { public static Equivalence<TypeMirror> equivalence() { return TypeEquivalence.INSTANCE; } private MoreTypes(); static Equivalence<TypeMirror> equivalence(); static ImmutableSet<TypeElement> referencedTypes(TypeMirror type); static Element asElement(TypeMirror typeMirror); static TypeElement asTypeElement(Ty... | MoreTypes { public static Equivalence<TypeMirror> equivalence() { return TypeEquivalence.INSTANCE; } private MoreTypes(); static Equivalence<TypeMirror> equivalence(); static ImmutableSet<TypeElement> referencedTypes(TypeMirror type); static Element asElement(TypeMirror typeMirror); static TypeElement asTypeElement(Ty... |
@Test public void testReferencedTypes() { Elements elements = compilationRule.getElements(); TypeElement testDataElement = elements .getTypeElement(ReferencedTypesTestData.class.getCanonicalName()); ImmutableMap<String, VariableElement> fieldIndex = FluentIterable.from(ElementFilter.fieldsIn(testDataElement.getEnclosed... | public static ImmutableSet<TypeElement> referencedTypes(TypeMirror type) { checkNotNull(type); ImmutableSet.Builder<TypeElement> elements = ImmutableSet.builder(); type.accept(ReferencedTypes.INSTANCE, elements); return elements.build(); } | MoreTypes { public static ImmutableSet<TypeElement> referencedTypes(TypeMirror type) { checkNotNull(type); ImmutableSet.Builder<TypeElement> elements = ImmutableSet.builder(); type.accept(ReferencedTypes.INSTANCE, elements); return elements.build(); } } | MoreTypes { public static ImmutableSet<TypeElement> referencedTypes(TypeMirror type) { checkNotNull(type); ImmutableSet.Builder<TypeElement> elements = ImmutableSet.builder(); type.accept(ReferencedTypes.INSTANCE, elements); return elements.build(); } private MoreTypes(); } | MoreTypes { public static ImmutableSet<TypeElement> referencedTypes(TypeMirror type) { checkNotNull(type); ImmutableSet.Builder<TypeElement> elements = ImmutableSet.builder(); type.accept(ReferencedTypes.INSTANCE, elements); return elements.build(); } private MoreTypes(); static Equivalence<TypeMirror> equivalence(); ... | MoreTypes { public static ImmutableSet<TypeElement> referencedTypes(TypeMirror type) { checkNotNull(type); ImmutableSet.Builder<TypeElement> elements = ImmutableSet.builder(); type.accept(ReferencedTypes.INSTANCE, elements); return elements.build(); } private MoreTypes(); static Equivalence<TypeMirror> equivalence(); ... |
@Test public void asElement_throws() { TypeMirror javaDotLang = compilationRule.getElements().getPackageElement("java.lang").asType(); try { MoreTypes.asElement(javaDotLang); fail(); } catch (IllegalArgumentException expected) {} } | public static Element asElement(TypeMirror typeMirror) { return typeMirror.accept(AsElementVisitor.INSTANCE, null); } | MoreTypes { public static Element asElement(TypeMirror typeMirror) { return typeMirror.accept(AsElementVisitor.INSTANCE, null); } } | MoreTypes { public static Element asElement(TypeMirror typeMirror) { return typeMirror.accept(AsElementVisitor.INSTANCE, null); } private MoreTypes(); } | MoreTypes { public static Element asElement(TypeMirror typeMirror) { return typeMirror.accept(AsElementVisitor.INSTANCE, null); } private MoreTypes(); static Equivalence<TypeMirror> equivalence(); static ImmutableSet<TypeElement> referencedTypes(TypeMirror type); static Element asElement(TypeMirror typeMirror); static... | MoreTypes { public static Element asElement(TypeMirror typeMirror) { return typeMirror.accept(AsElementVisitor.INSTANCE, null); } private MoreTypes(); static Equivalence<TypeMirror> equivalence(); static ImmutableSet<TypeElement> referencedTypes(TypeMirror type); static Element asElement(TypeMirror typeMirror); static... |
@Test public void asElement() { Elements elements = compilationRule.getElements(); TypeElement stringElement = elements.getTypeElement("java.lang.String"); assertThat(MoreTypes.asElement(stringElement.asType())).isEqualTo(stringElement); TypeParameterElement setParameterElement = Iterables.getOnlyElement( compilationRu... | public static Element asElement(TypeMirror typeMirror) { return typeMirror.accept(AsElementVisitor.INSTANCE, null); } | MoreTypes { public static Element asElement(TypeMirror typeMirror) { return typeMirror.accept(AsElementVisitor.INSTANCE, null); } } | MoreTypes { public static Element asElement(TypeMirror typeMirror) { return typeMirror.accept(AsElementVisitor.INSTANCE, null); } private MoreTypes(); } | MoreTypes { public static Element asElement(TypeMirror typeMirror) { return typeMirror.accept(AsElementVisitor.INSTANCE, null); } private MoreTypes(); static Equivalence<TypeMirror> equivalence(); static ImmutableSet<TypeElement> referencedTypes(TypeMirror type); static Element asElement(TypeMirror typeMirror); static... | MoreTypes { public static Element asElement(TypeMirror typeMirror) { return typeMirror.accept(AsElementVisitor.INSTANCE, null); } private MoreTypes(); static Equivalence<TypeMirror> equivalence(); static ImmutableSet<TypeElement> referencedTypes(TypeMirror type); static Element asElement(TypeMirror typeMirror); static... |
@Test public void testNonObjectSuperclass() { Types types = compilationRule.getTypes(); Elements elements = compilationRule.getElements(); TypeMirror numberType = elements.getTypeElement(Number.class.getCanonicalName()).asType(); TypeMirror stringType = elements.getTypeElement(String.class.getCanonicalName()).asType();... | public static Optional<DeclaredType> nonObjectSuperclass(Types types, Elements elements, DeclaredType type) { checkNotNull(types); checkNotNull(elements); checkNotNull(type); TypeMirror superclassType = asTypeElement(type).getSuperclass(); if (!isType(superclassType)) { return Optional.absent(); } DeclaredType supercla... | MoreTypes { public static Optional<DeclaredType> nonObjectSuperclass(Types types, Elements elements, DeclaredType type) { checkNotNull(types); checkNotNull(elements); checkNotNull(type); TypeMirror superclassType = asTypeElement(type).getSuperclass(); if (!isType(superclassType)) { return Optional.absent(); } DeclaredT... | MoreTypes { public static Optional<DeclaredType> nonObjectSuperclass(Types types, Elements elements, DeclaredType type) { checkNotNull(types); checkNotNull(elements); checkNotNull(type); TypeMirror superclassType = asTypeElement(type).getSuperclass(); if (!isType(superclassType)) { return Optional.absent(); } DeclaredT... | MoreTypes { public static Optional<DeclaredType> nonObjectSuperclass(Types types, Elements elements, DeclaredType type) { checkNotNull(types); checkNotNull(elements); checkNotNull(type); TypeMirror superclassType = asTypeElement(type).getSuperclass(); if (!isType(superclassType)) { return Optional.absent(); } DeclaredT... | MoreTypes { public static Optional<DeclaredType> nonObjectSuperclass(Types types, Elements elements, DeclaredType type) { checkNotNull(types); checkNotNull(elements); checkNotNull(type); TypeMirror superclassType = asTypeElement(type).getSuperclass(); if (!isType(superclassType)) { return Optional.absent(); } DeclaredT... |
@Test public void testIsConversionFromObjectUnchecked_yes() { Elements elements = compilationRule.getElements(); TypeElement unchecked = elements.getTypeElement(Unchecked.class.getCanonicalName()); for (VariableElement field : ElementFilter.fieldsIn(unchecked.getEnclosedElements())) { TypeMirror type = field.asType(); ... | public static boolean isConversionFromObjectUnchecked(TypeMirror type) { return new CastingUncheckedVisitor().visit(type, null); } | MoreTypes { public static boolean isConversionFromObjectUnchecked(TypeMirror type) { return new CastingUncheckedVisitor().visit(type, null); } } | MoreTypes { public static boolean isConversionFromObjectUnchecked(TypeMirror type) { return new CastingUncheckedVisitor().visit(type, null); } private MoreTypes(); } | MoreTypes { public static boolean isConversionFromObjectUnchecked(TypeMirror type) { return new CastingUncheckedVisitor().visit(type, null); } private MoreTypes(); static Equivalence<TypeMirror> equivalence(); static ImmutableSet<TypeElement> referencedTypes(TypeMirror type); static Element asElement(TypeMirror typeMi... | MoreTypes { public static boolean isConversionFromObjectUnchecked(TypeMirror type) { return new CastingUncheckedVisitor().visit(type, null); } private MoreTypes(); static Equivalence<TypeMirror> equivalence(); static ImmutableSet<TypeElement> referencedTypes(TypeMirror type); static Element asElement(TypeMirror typeMi... |
@Test public void testIsConversionFromObjectUnchecked_no() { Elements elements = compilationRule.getElements(); TypeElement notUnchecked = elements.getTypeElement(NotUnchecked.class.getCanonicalName()); for (VariableElement field : ElementFilter.fieldsIn(notUnchecked.getEnclosedElements())) { TypeMirror type = field.as... | public static boolean isConversionFromObjectUnchecked(TypeMirror type) { return new CastingUncheckedVisitor().visit(type, null); } | MoreTypes { public static boolean isConversionFromObjectUnchecked(TypeMirror type) { return new CastingUncheckedVisitor().visit(type, null); } } | MoreTypes { public static boolean isConversionFromObjectUnchecked(TypeMirror type) { return new CastingUncheckedVisitor().visit(type, null); } private MoreTypes(); } | MoreTypes { public static boolean isConversionFromObjectUnchecked(TypeMirror type) { return new CastingUncheckedVisitor().visit(type, null); } private MoreTypes(); static Equivalence<TypeMirror> equivalence(); static ImmutableSet<TypeElement> referencedTypes(TypeMirror type); static Element asElement(TypeMirror typeMi... | MoreTypes { public static boolean isConversionFromObjectUnchecked(TypeMirror type) { return new CastingUncheckedVisitor().visit(type, null); } private MoreTypes(); static Equivalence<TypeMirror> equivalence(); static ImmutableSet<TypeElement> referencedTypes(TypeMirror type); static Element asElement(TypeMirror typeMi... |
@Test public void arrays() { SimpleTypeAnnotationValue.of(types.getArrayType(objectType)); SimpleTypeAnnotationValue.of(types.getArrayType(primitiveType)); } | public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } | SimpleTypeAnnotationValue implements AnnotationValue { public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } } | SimpleTypeAnnotationValue implements AnnotationValue { public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } private SimpleTypeAnnotationValue(TypeMirror value); } | SimpleTypeAnnotationValue implements AnnotationValue { public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } private SimpleTypeAnnotationValue(TypeMirror value); static AnnotationValue of(TypeMirror value); @Override TypeMirror getValue(); @Override String toString(); @Ove... | SimpleTypeAnnotationValue implements AnnotationValue { public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } private SimpleTypeAnnotationValue(TypeMirror value); static AnnotationValue of(TypeMirror value); @Override TypeMirror getValue(); @Override String toString(); @Ove... |
@Test public void declaredType() { SimpleTypeAnnotationValue.of(objectType); } | public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } | SimpleTypeAnnotationValue implements AnnotationValue { public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } } | SimpleTypeAnnotationValue implements AnnotationValue { public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } private SimpleTypeAnnotationValue(TypeMirror value); } | SimpleTypeAnnotationValue implements AnnotationValue { public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } private SimpleTypeAnnotationValue(TypeMirror value); static AnnotationValue of(TypeMirror value); @Override TypeMirror getValue(); @Override String toString(); @Ove... | SimpleTypeAnnotationValue implements AnnotationValue { public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } private SimpleTypeAnnotationValue(TypeMirror value); static AnnotationValue of(TypeMirror value); @Override TypeMirror getValue(); @Override String toString(); @Ove... |
@Test public void getSerializer_optional_serializerReturned() { TypeMirror typeMirror = typeMirrorOf(Optional.class); Serializer actualSerializer = extension.getSerializer(typeMirror, fakeSerializerFactory, mockProcessingEnvironment).get(); assertThat(actualSerializer.getClass().getName()) .contains("OptionalSerializer... | @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Serializer containedTypeSerializer = factory.getSerializer(cont... | OptionalSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Se... | OptionalSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Se... | OptionalSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Se... | OptionalSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Se... |
@Test public void parameterizedType() { try { SimpleTypeAnnotationValue.of( types.getDeclaredType( elements.getTypeElement(List.class.getCanonicalName()), objectType)); fail("Expected an exception"); } catch (IllegalArgumentException expected) { } } | public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } | SimpleTypeAnnotationValue implements AnnotationValue { public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } } | SimpleTypeAnnotationValue implements AnnotationValue { public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } private SimpleTypeAnnotationValue(TypeMirror value); } | SimpleTypeAnnotationValue implements AnnotationValue { public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } private SimpleTypeAnnotationValue(TypeMirror value); static AnnotationValue of(TypeMirror value); @Override TypeMirror getValue(); @Override String toString(); @Ove... | SimpleTypeAnnotationValue implements AnnotationValue { public static AnnotationValue of(TypeMirror value) { return new SimpleTypeAnnotationValue(value); } private SimpleTypeAnnotationValue(TypeMirror value); static AnnotationValue of(TypeMirror value); @Override TypeMirror getValue(); @Override String toString(); @Ove... |
@Test public void extraValues() { TypeElement multipleValues = getTypeElement(MultipleValues.class); Map<String, AnnotationValue> values = new HashMap<>(); values.put("value1", intValue(1)); values.put("value2", intValue(2)); values.put("value3", intValue(3)); expectThrows(() -> SimpleAnnotationMirror.of(multipleValues... | public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } | SimpleAnnotationMirror implements AnnotationMirror { public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } } | SimpleAnnotationMirror implements AnnotationMirror { public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } private SimpleAnnotationMirror(
TypeElement annotationType, Map<String, ? extends AnnotationValue> namedValues); } | SimpleAnnotationMirror implements AnnotationMirror { public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } private SimpleAnnotationMirror(
TypeElement annotationType, Map<String, ? extends AnnotationValue> namedValues); static AnnotationMirror of(TypeElem... | SimpleAnnotationMirror implements AnnotationMirror { public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } private SimpleAnnotationMirror(
TypeElement annotationType, Map<String, ? extends AnnotationValue> namedValues); static AnnotationMirror of(TypeElem... |
@Test public void missingValues() { TypeElement multipleValues = getTypeElement(MultipleValues.class); expectThrows(() -> SimpleAnnotationMirror.of(multipleValues)); } | public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } | SimpleAnnotationMirror implements AnnotationMirror { public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } } | SimpleAnnotationMirror implements AnnotationMirror { public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } private SimpleAnnotationMirror(
TypeElement annotationType, Map<String, ? extends AnnotationValue> namedValues); } | SimpleAnnotationMirror implements AnnotationMirror { public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } private SimpleAnnotationMirror(
TypeElement annotationType, Map<String, ? extends AnnotationValue> namedValues); static AnnotationMirror of(TypeElem... | SimpleAnnotationMirror implements AnnotationMirror { public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } private SimpleAnnotationMirror(
TypeElement annotationType, Map<String, ? extends AnnotationValue> namedValues); static AnnotationMirror of(TypeElem... |
@Test public void notAnAnnotation() { TypeElement stringElement = getTypeElement(String.class); expectThrows(() -> SimpleAnnotationMirror.of(stringElement)); } | public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } | SimpleAnnotationMirror implements AnnotationMirror { public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } } | SimpleAnnotationMirror implements AnnotationMirror { public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } private SimpleAnnotationMirror(
TypeElement annotationType, Map<String, ? extends AnnotationValue> namedValues); } | SimpleAnnotationMirror implements AnnotationMirror { public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } private SimpleAnnotationMirror(
TypeElement annotationType, Map<String, ? extends AnnotationValue> namedValues); static AnnotationMirror of(TypeElem... | SimpleAnnotationMirror implements AnnotationMirror { public static AnnotationMirror of(TypeElement annotationType) { return of(annotationType, ImmutableMap.of()); } private SimpleAnnotationMirror(
TypeElement annotationType, Map<String, ? extends AnnotationValue> namedValues); static AnnotationMirror of(TypeElem... |
@Test public void testEquivalences() { EquivalenceTester<AnnotationMirror> tester = EquivalenceTester.of(AnnotationMirrors.equivalence()); tester.addEquivalenceGroup( annotationOn(SimplyAnnotated.class), annotationOn(AlsoSimplyAnnotated.class)); tester.addEquivalenceGroup( annotationOn(TestClassBlah.class), annotationO... | public static Equivalence<AnnotationMirror> equivalence() { return ANNOTATION_MIRROR_EQUIVALENCE; } | AnnotationMirrors { public static Equivalence<AnnotationMirror> equivalence() { return ANNOTATION_MIRROR_EQUIVALENCE; } } | AnnotationMirrors { public static Equivalence<AnnotationMirror> equivalence() { return ANNOTATION_MIRROR_EQUIVALENCE; } private AnnotationMirrors(); } | AnnotationMirrors { public static Equivalence<AnnotationMirror> equivalence() { return ANNOTATION_MIRROR_EQUIVALENCE; } private AnnotationMirrors(); static Equivalence<AnnotationMirror> equivalence(); static ImmutableMap<ExecutableElement, AnnotationValue> getAnnotationValuesWithDefaults(
AnnotationMirror annota... | AnnotationMirrors { public static Equivalence<AnnotationMirror> equivalence() { return ANNOTATION_MIRROR_EQUIVALENCE; } private AnnotationMirrors(); static Equivalence<AnnotationMirror> equivalence(); static ImmutableMap<ExecutableElement, AnnotationValue> getAnnotationValuesWithDefaults(
AnnotationMirror annota... |
@Test public void testGetDefaultValuesUnset() { assertThat(annotationOn(StringyUnset.class).getElementValues()).isEmpty(); Iterable<AnnotationValue> values = AnnotationMirrors.getAnnotationValuesWithDefaults( annotationOn(StringyUnset.class)).values(); String value = getOnlyElement(values).accept(new SimpleAnnotationVa... | public static ImmutableMap<ExecutableElement, AnnotationValue> getAnnotationValuesWithDefaults( AnnotationMirror annotation) { ImmutableMap.Builder<ExecutableElement, AnnotationValue> values = ImmutableMap.builder(); Map<? extends ExecutableElement, ? extends AnnotationValue> declaredValues = annotation.getElementValue... | AnnotationMirrors { public static ImmutableMap<ExecutableElement, AnnotationValue> getAnnotationValuesWithDefaults( AnnotationMirror annotation) { ImmutableMap.Builder<ExecutableElement, AnnotationValue> values = ImmutableMap.builder(); Map<? extends ExecutableElement, ? extends AnnotationValue> declaredValues = annota... | AnnotationMirrors { public static ImmutableMap<ExecutableElement, AnnotationValue> getAnnotationValuesWithDefaults( AnnotationMirror annotation) { ImmutableMap.Builder<ExecutableElement, AnnotationValue> values = ImmutableMap.builder(); Map<? extends ExecutableElement, ? extends AnnotationValue> declaredValues = annota... | AnnotationMirrors { public static ImmutableMap<ExecutableElement, AnnotationValue> getAnnotationValuesWithDefaults( AnnotationMirror annotation) { ImmutableMap.Builder<ExecutableElement, AnnotationValue> values = ImmutableMap.builder(); Map<? extends ExecutableElement, ? extends AnnotationValue> declaredValues = annota... | AnnotationMirrors { public static ImmutableMap<ExecutableElement, AnnotationValue> getAnnotationValuesWithDefaults( AnnotationMirror annotation) { ImmutableMap.Builder<ExecutableElement, AnnotationValue> values = ImmutableMap.builder(); Map<? extends ExecutableElement, ? extends AnnotationValue> declaredValues = annota... |
@Test public void testGetDefaultValuesSet() { Iterable<AnnotationValue> values = AnnotationMirrors.getAnnotationValuesWithDefaults( annotationOn(StringySet.class)).values(); String value = getOnlyElement(values).accept(new SimpleAnnotationValueVisitor6<String, Void>() { @Override public String visitString(String value,... | public static ImmutableMap<ExecutableElement, AnnotationValue> getAnnotationValuesWithDefaults( AnnotationMirror annotation) { ImmutableMap.Builder<ExecutableElement, AnnotationValue> values = ImmutableMap.builder(); Map<? extends ExecutableElement, ? extends AnnotationValue> declaredValues = annotation.getElementValue... | AnnotationMirrors { public static ImmutableMap<ExecutableElement, AnnotationValue> getAnnotationValuesWithDefaults( AnnotationMirror annotation) { ImmutableMap.Builder<ExecutableElement, AnnotationValue> values = ImmutableMap.builder(); Map<? extends ExecutableElement, ? extends AnnotationValue> declaredValues = annota... | AnnotationMirrors { public static ImmutableMap<ExecutableElement, AnnotationValue> getAnnotationValuesWithDefaults( AnnotationMirror annotation) { ImmutableMap.Builder<ExecutableElement, AnnotationValue> values = ImmutableMap.builder(); Map<? extends ExecutableElement, ? extends AnnotationValue> declaredValues = annota... | AnnotationMirrors { public static ImmutableMap<ExecutableElement, AnnotationValue> getAnnotationValuesWithDefaults( AnnotationMirror annotation) { ImmutableMap.Builder<ExecutableElement, AnnotationValue> values = ImmutableMap.builder(); Map<? extends ExecutableElement, ? extends AnnotationValue> declaredValues = annota... | AnnotationMirrors { public static ImmutableMap<ExecutableElement, AnnotationValue> getAnnotationValuesWithDefaults( AnnotationMirror annotation) { ImmutableMap.Builder<ExecutableElement, AnnotationValue> values = ImmutableMap.builder(); Map<? extends ExecutableElement, ? extends AnnotationValue> declaredValues = annota... |
@Test public void testGetValueEntryFailure() { try { AnnotationMirrors.getAnnotationValue(annotationOn(TestClassBlah.class), "a"); } catch (IllegalArgumentException e) { assertThat(e) .hasMessageThat() .isEqualTo( "@com.google.auto.common.AnnotationMirrorsTest.Outer does not define an element a()"); return; } fail("Sho... | public static AnnotationValue getAnnotationValue( AnnotationMirror annotationMirror, String elementName) { return getAnnotationElementAndValue(annotationMirror, elementName).getValue(); } | AnnotationMirrors { public static AnnotationValue getAnnotationValue( AnnotationMirror annotationMirror, String elementName) { return getAnnotationElementAndValue(annotationMirror, elementName).getValue(); } } | AnnotationMirrors { public static AnnotationValue getAnnotationValue( AnnotationMirror annotationMirror, String elementName) { return getAnnotationElementAndValue(annotationMirror, elementName).getValue(); } private AnnotationMirrors(); } | AnnotationMirrors { public static AnnotationValue getAnnotationValue( AnnotationMirror annotationMirror, String elementName) { return getAnnotationElementAndValue(annotationMirror, elementName).getValue(); } private AnnotationMirrors(); static Equivalence<AnnotationMirror> equivalence(); static ImmutableMap<Executable... | AnnotationMirrors { public static AnnotationValue getAnnotationValue( AnnotationMirror annotationMirror, String elementName) { return getAnnotationElementAndValue(annotationMirror, elementName).getValue(); } private AnnotationMirrors(); static Equivalence<AnnotationMirror> equivalence(); static ImmutableMap<Executable... |
@Test public void getTypeMirror() { TypeElement insideClassA = getTypeElement(InsideClassA.class); AnnotationValue value = AnnotationMirrors.getAnnotationValue(annotationMirror, "classValue"); assertThat(AnnotationValues.getTypeMirror(value).asElement()).isEqualTo(insideClassA); } | public static DeclaredType getTypeMirror(AnnotationValue value) { return TypeMirrorVisitor.INSTANCE.visit(value); } | AnnotationValues { public static DeclaredType getTypeMirror(AnnotationValue value) { return TypeMirrorVisitor.INSTANCE.visit(value); } } | AnnotationValues { public static DeclaredType getTypeMirror(AnnotationValue value) { return TypeMirrorVisitor.INSTANCE.visit(value); } private AnnotationValues(); } | AnnotationValues { public static DeclaredType getTypeMirror(AnnotationValue value) { return TypeMirrorVisitor.INSTANCE.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Ann... | AnnotationValues { public static DeclaredType getTypeMirror(AnnotationValue value) { return TypeMirrorVisitor.INSTANCE.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Ann... |
@Test public void getTypeMirrorGenericClass() { TypeElement genericClass = getTypeElement(GenericClass.class); AnnotationValue gvalue = AnnotationMirrors.getAnnotationValue(annotationMirror, "genericClassValue"); assertThat(AnnotationValues.getTypeMirror(gvalue).asElement()).isEqualTo(genericClass); } | public static DeclaredType getTypeMirror(AnnotationValue value) { return TypeMirrorVisitor.INSTANCE.visit(value); } | AnnotationValues { public static DeclaredType getTypeMirror(AnnotationValue value) { return TypeMirrorVisitor.INSTANCE.visit(value); } } | AnnotationValues { public static DeclaredType getTypeMirror(AnnotationValue value) { return TypeMirrorVisitor.INSTANCE.visit(value); } private AnnotationValues(); } | AnnotationValues { public static DeclaredType getTypeMirror(AnnotationValue value) { return TypeMirrorVisitor.INSTANCE.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Ann... | AnnotationValues { public static DeclaredType getTypeMirror(AnnotationValue value) { return TypeMirrorVisitor.INSTANCE.visit(value); } private AnnotationValues(); static Equivalence<AnnotationValue> equivalence(); static DeclaredType getTypeMirror(AnnotationValue value); static AnnotationMirror getAnnotationMirror(Ann... |
@Test public void proxyFieldType() { TypeMirror typeMirror = declaredTypeOf(Optional.class, Integer.class); Serializer serializer = extension.getSerializer(typeMirror, fakeSerializerFactory, mockProcessingEnvironment).get(); TypeMirror actualTypeMirror = serializer.proxyFieldType(); assertThat(actualTypeMirror).isEqual... | @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Serializer containedTypeSerializer = factory.getSerializer(cont... | OptionalSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Se... | OptionalSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Se... | OptionalSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Se... | OptionalSerializerExtension implements SerializerExtension { @Override public Optional<Serializer> getSerializer( TypeMirror typeMirror, SerializerFactory factory, ProcessingEnvironment processingEnv) { if (!isOptional(typeMirror)) { return Optional.empty(); } TypeMirror containedType = getContainedType(typeMirror); Se... |
@Test public void testBaseActionImpl() { assertEquals("AVERAGE",ExecutionActions.AVERAGE.toString()); } | public BaseActionImpl() { } | BaseActionImpl { public BaseActionImpl() { } } | BaseActionImpl { public BaseActionImpl() { } BaseActionImpl(); BaseActionImpl(InferenceConfigDefinition kpiDefinition); } | BaseActionImpl { public BaseActionImpl() { } BaseActionImpl(); BaseActionImpl(InferenceConfigDefinition kpiDefinition); } | BaseActionImpl { public BaseActionImpl() { } BaseActionImpl(); BaseActionImpl(InferenceConfigDefinition kpiDefinition); } |
@Test public void testExecuteCypherQuery() { String cypherQuery = "MATCH (n:ALM) where not exists (n.processed) with n limit 100 set n.processed=true return count(n)"; DataEnrichmentModel model = new DataEnrichmentModel(); Boolean resultFlag = executor.executeCypherQuery(cypherQuery, model); assertTrue(resultFlag); } | public Boolean executeCypherQuery(String cypherQuery, DataEnrichmentModel dataEnrichmentModel) { GraphDBHandler dbHandler = new GraphDBHandler(); int processedRecords = 1; int recordCount = 0; long queryExecutionStartTime = System.currentTimeMillis(); try { while (processedRecords > 0) { GraphResponse sprintResponse = ... | OfflineDataProcessingExecutor extends TimerTask { public Boolean executeCypherQuery(String cypherQuery, DataEnrichmentModel dataEnrichmentModel) { GraphDBHandler dbHandler = new GraphDBHandler(); int processedRecords = 1; int recordCount = 0; long queryExecutionStartTime = System.currentTimeMillis(); try { while (proce... | OfflineDataProcessingExecutor extends TimerTask { public Boolean executeCypherQuery(String cypherQuery, DataEnrichmentModel dataEnrichmentModel) { GraphDBHandler dbHandler = new GraphDBHandler(); int processedRecords = 1; int recordCount = 0; long queryExecutionStartTime = System.currentTimeMillis(); try { while (proce... | OfflineDataProcessingExecutor extends TimerTask { public Boolean executeCypherQuery(String cypherQuery, DataEnrichmentModel dataEnrichmentModel) { GraphDBHandler dbHandler = new GraphDBHandler(); int processedRecords = 1; int recordCount = 0; long queryExecutionStartTime = System.currentTimeMillis(); try { while (proce... | OfflineDataProcessingExecutor extends TimerTask { public Boolean executeCypherQuery(String cypherQuery, DataEnrichmentModel dataEnrichmentModel) { GraphDBHandler dbHandler = new GraphDBHandler(); int processedRecords = 1; int recordCount = 0; long queryExecutionStartTime = System.currentTimeMillis(); try { while (proce... |
@Test public void testExecuteCypherQueryNegative() { String cypherQuery = "MATCH (n:ALM) where not exists (n.processed) with n limit 100 set n.processed=true return n"; DataEnrichmentModel model = new DataEnrichmentModel(); Boolean resultFlag = executor.executeCypherQuery(cypherQuery, model); assertFalse(resultFlag); } | public Boolean executeCypherQuery(String cypherQuery, DataEnrichmentModel dataEnrichmentModel) { GraphDBHandler dbHandler = new GraphDBHandler(); int processedRecords = 1; int recordCount = 0; long queryExecutionStartTime = System.currentTimeMillis(); try { while (processedRecords > 0) { GraphResponse sprintResponse = ... | OfflineDataProcessingExecutor extends TimerTask { public Boolean executeCypherQuery(String cypherQuery, DataEnrichmentModel dataEnrichmentModel) { GraphDBHandler dbHandler = new GraphDBHandler(); int processedRecords = 1; int recordCount = 0; long queryExecutionStartTime = System.currentTimeMillis(); try { while (proce... | OfflineDataProcessingExecutor extends TimerTask { public Boolean executeCypherQuery(String cypherQuery, DataEnrichmentModel dataEnrichmentModel) { GraphDBHandler dbHandler = new GraphDBHandler(); int processedRecords = 1; int recordCount = 0; long queryExecutionStartTime = System.currentTimeMillis(); try { while (proce... | OfflineDataProcessingExecutor extends TimerTask { public Boolean executeCypherQuery(String cypherQuery, DataEnrichmentModel dataEnrichmentModel) { GraphDBHandler dbHandler = new GraphDBHandler(); int processedRecords = 1; int recordCount = 0; long queryExecutionStartTime = System.currentTimeMillis(); try { while (proce... | OfflineDataProcessingExecutor extends TimerTask { public Boolean executeCypherQuery(String cypherQuery, DataEnrichmentModel dataEnrichmentModel) { GraphDBHandler dbHandler = new GraphDBHandler(); int processedRecords = 1; int recordCount = 0; long queryExecutionStartTime = System.currentTimeMillis(); try { while (proce... |
@Test public void testIsQueryScheduledToRun() { Long runSchedule = 720L; String lastRunTime = "2018/07/16 05:50 PM"; assertTrue(executor.isQueryScheduledToRun(runSchedule, lastRunTime, null)); } | public Boolean isQueryScheduledToRun(Long runSchedule, String lastRunTime, String cronSchedule) { if (lastRunTime == null && (cronSchedule == null || cronSchedule.trim().length() == 0)) { return Boolean.TRUE; } ZonedDateTime dateTime = null; ZonedDateTime now = ZonedDateTime.now(InsightsUtils.zoneId); Long timeDifferen... | OfflineDataProcessingExecutor extends TimerTask { public Boolean isQueryScheduledToRun(Long runSchedule, String lastRunTime, String cronSchedule) { if (lastRunTime == null && (cronSchedule == null || cronSchedule.trim().length() == 0)) { return Boolean.TRUE; } ZonedDateTime dateTime = null; ZonedDateTime now = ZonedDat... | OfflineDataProcessingExecutor extends TimerTask { public Boolean isQueryScheduledToRun(Long runSchedule, String lastRunTime, String cronSchedule) { if (lastRunTime == null && (cronSchedule == null || cronSchedule.trim().length() == 0)) { return Boolean.TRUE; } ZonedDateTime dateTime = null; ZonedDateTime now = ZonedDat... | OfflineDataProcessingExecutor extends TimerTask { public Boolean isQueryScheduledToRun(Long runSchedule, String lastRunTime, String cronSchedule) { if (lastRunTime == null && (cronSchedule == null || cronSchedule.trim().length() == 0)) { return Boolean.TRUE; } ZonedDateTime dateTime = null; ZonedDateTime now = ZonedDat... | OfflineDataProcessingExecutor extends TimerTask { public Boolean isQueryScheduledToRun(Long runSchedule, String lastRunTime, String cronSchedule) { if (lastRunTime == null && (cronSchedule == null || cronSchedule.trim().length() == 0)) { return Boolean.TRUE; } ZonedDateTime dateTime = null; ZonedDateTime now = ZonedDat... |
@Test public void testGetEsQueryWithDates() { String esQuery = "query"; JobSchedule schedule = null; } | protected String getEsQueryWithDates(JobSchedule schedule, String esQuery) { Long fromDate = InsightsUtils.getDataFromTime(schedule.name()); esQuery = esQuery.replace("__dataFromTime__", fromDate.toString()); Long toDate = InsightsUtils.getDataToTime(schedule.name()); esQuery = esQuery.replace("__dataToTime__", toDate.... | BaseActionImpl { protected String getEsQueryWithDates(JobSchedule schedule, String esQuery) { Long fromDate = InsightsUtils.getDataFromTime(schedule.name()); esQuery = esQuery.replace("__dataFromTime__", fromDate.toString()); Long toDate = InsightsUtils.getDataToTime(schedule.name()); esQuery = esQuery.replace("__dataT... | BaseActionImpl { protected String getEsQueryWithDates(JobSchedule schedule, String esQuery) { Long fromDate = InsightsUtils.getDataFromTime(schedule.name()); esQuery = esQuery.replace("__dataFromTime__", fromDate.toString()); Long toDate = InsightsUtils.getDataToTime(schedule.name()); esQuery = esQuery.replace("__dataT... | BaseActionImpl { protected String getEsQueryWithDates(JobSchedule schedule, String esQuery) { Long fromDate = InsightsUtils.getDataFromTime(schedule.name()); esQuery = esQuery.replace("__dataFromTime__", fromDate.toString()); Long toDate = InsightsUtils.getDataToTime(schedule.name()); esQuery = esQuery.replace("__dataT... | BaseActionImpl { protected String getEsQueryWithDates(JobSchedule schedule, String esQuery) { Long fromDate = InsightsUtils.getDataFromTime(schedule.name()); esQuery = esQuery.replace("__dataFromTime__", fromDate.toString()); Long toDate = InsightsUtils.getDataToTime(schedule.name()); esQuery = esQuery.replace("__dataT... |
@Test public void testExecute() { load(); Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put("Jobs", "Success"); } | @Override protected void execute() throws InsightsJobFailedException { executeNeo4jGraphQuery(); } | CountActionImpl extends BaseActionImpl { @Override protected void execute() throws InsightsJobFailedException { executeNeo4jGraphQuery(); } } | CountActionImpl extends BaseActionImpl { @Override protected void execute() throws InsightsJobFailedException { executeNeo4jGraphQuery(); } CountActionImpl(InferenceConfigDefinition kpiDefinition); } | CountActionImpl extends BaseActionImpl { @Override protected void execute() throws InsightsJobFailedException { executeNeo4jGraphQuery(); } CountActionImpl(InferenceConfigDefinition kpiDefinition); } | CountActionImpl extends BaseActionImpl { @Override protected void execute() throws InsightsJobFailedException { executeNeo4jGraphQuery(); } CountActionImpl(InferenceConfigDefinition kpiDefinition); } |
@Test public void testExecute() throws InsightsJobFailedException { load(); Map<String, Object> resultMap = new HashMap<String, Object>(); resultMap.put("Jobs", "Success"); } | @Override protected void execute() throws InsightsJobFailedException { executeNeo4jGraphQuery(); } | MinMaxActionImpl extends BaseActionImpl { @Override protected void execute() throws InsightsJobFailedException { executeNeo4jGraphQuery(); } } | MinMaxActionImpl extends BaseActionImpl { @Override protected void execute() throws InsightsJobFailedException { executeNeo4jGraphQuery(); } MinMaxActionImpl(InferenceConfigDefinition kpiDefinition); } | MinMaxActionImpl extends BaseActionImpl { @Override protected void execute() throws InsightsJobFailedException { executeNeo4jGraphQuery(); } MinMaxActionImpl(InferenceConfigDefinition kpiDefinition); } | MinMaxActionImpl extends BaseActionImpl { @Override protected void execute() throws InsightsJobFailedException { executeNeo4jGraphQuery(); } MinMaxActionImpl(InferenceConfigDefinition kpiDefinition); } |
@Test public void testExecuteOfflineProcessingNegative() { AssertJUnit.assertNotSame(6, executor.executeOfflineProcessing()); } | public int executeOfflineProcessing() { File queryFolderPath = new File(ConfigOptions.OFFLINE_DATA_PROCESSING_RESOLVED_PATH); File[] files = queryFolderPath.listFiles(); int jsonFileCount = 0; if (files == null) { return jsonFileCount; } for (File eachFile : files) { if (eachFile.isFile()) { String fileName = eachFile.... | OfflineDataProcessingExecutor extends TimerTask { public int executeOfflineProcessing() { File queryFolderPath = new File(ConfigOptions.OFFLINE_DATA_PROCESSING_RESOLVED_PATH); File[] files = queryFolderPath.listFiles(); int jsonFileCount = 0; if (files == null) { return jsonFileCount; } for (File eachFile : files) { if... | OfflineDataProcessingExecutor extends TimerTask { public int executeOfflineProcessing() { File queryFolderPath = new File(ConfigOptions.OFFLINE_DATA_PROCESSING_RESOLVED_PATH); File[] files = queryFolderPath.listFiles(); int jsonFileCount = 0; if (files == null) { return jsonFileCount; } for (File eachFile : files) { if... | OfflineDataProcessingExecutor extends TimerTask { public int executeOfflineProcessing() { File queryFolderPath = new File(ConfigOptions.OFFLINE_DATA_PROCESSING_RESOLVED_PATH); File[] files = queryFolderPath.listFiles(); int jsonFileCount = 0; if (files == null) { return jsonFileCount; } for (File eachFile : files) { if... | OfflineDataProcessingExecutor extends TimerTask { public int executeOfflineProcessing() { File queryFolderPath = new File(ConfigOptions.OFFLINE_DATA_PROCESSING_RESOLVED_PATH); File[] files = queryFolderPath.listFiles(); int jsonFileCount = 0; if (files == null) { return jsonFileCount; } for (File eachFile : files) { if... |
@Test public void testHasJsonFileExtension() { String fileName = "data-enrichment.JSON"; Boolean hasJsonFileExtension = executor.hasJsonFileExtension(fileName); assertTrue(hasJsonFileExtension); } | public Boolean hasJsonFileExtension(String fileName) { if (fileName != null && !fileName.isEmpty()) { String extension = FilenameUtils.getExtension(fileName); if (JSON_FILE_EXTENSION.equalsIgnoreCase(extension)) { return Boolean.TRUE; } } return Boolean.FALSE; } | OfflineDataProcessingExecutor extends TimerTask { public Boolean hasJsonFileExtension(String fileName) { if (fileName != null && !fileName.isEmpty()) { String extension = FilenameUtils.getExtension(fileName); if (JSON_FILE_EXTENSION.equalsIgnoreCase(extension)) { return Boolean.TRUE; } } return Boolean.FALSE; } } | OfflineDataProcessingExecutor extends TimerTask { public Boolean hasJsonFileExtension(String fileName) { if (fileName != null && !fileName.isEmpty()) { String extension = FilenameUtils.getExtension(fileName); if (JSON_FILE_EXTENSION.equalsIgnoreCase(extension)) { return Boolean.TRUE; } } return Boolean.FALSE; } } | OfflineDataProcessingExecutor extends TimerTask { public Boolean hasJsonFileExtension(String fileName) { if (fileName != null && !fileName.isEmpty()) { String extension = FilenameUtils.getExtension(fileName); if (JSON_FILE_EXTENSION.equalsIgnoreCase(extension)) { return Boolean.TRUE; } } return Boolean.FALSE; } @Overr... | OfflineDataProcessingExecutor extends TimerTask { public Boolean hasJsonFileExtension(String fileName) { if (fileName != null && !fileName.isEmpty()) { String extension = FilenameUtils.getExtension(fileName); if (JSON_FILE_EXTENSION.equalsIgnoreCase(extension)) { return Boolean.TRUE; } } return Boolean.FALSE; } @Overr... |
@Test public void testHasJsonFileExtensionNegative() { String fileName = "neo4j_import_json.py"; Boolean hasJsonFileExtension = executor.hasJsonFileExtension(fileName); AssertJUnit.assertEquals(Boolean.FALSE, hasJsonFileExtension); } | public Boolean hasJsonFileExtension(String fileName) { if (fileName != null && !fileName.isEmpty()) { String extension = FilenameUtils.getExtension(fileName); if (JSON_FILE_EXTENSION.equalsIgnoreCase(extension)) { return Boolean.TRUE; } } return Boolean.FALSE; } | OfflineDataProcessingExecutor extends TimerTask { public Boolean hasJsonFileExtension(String fileName) { if (fileName != null && !fileName.isEmpty()) { String extension = FilenameUtils.getExtension(fileName); if (JSON_FILE_EXTENSION.equalsIgnoreCase(extension)) { return Boolean.TRUE; } } return Boolean.FALSE; } } | OfflineDataProcessingExecutor extends TimerTask { public Boolean hasJsonFileExtension(String fileName) { if (fileName != null && !fileName.isEmpty()) { String extension = FilenameUtils.getExtension(fileName); if (JSON_FILE_EXTENSION.equalsIgnoreCase(extension)) { return Boolean.TRUE; } } return Boolean.FALSE; } } | OfflineDataProcessingExecutor extends TimerTask { public Boolean hasJsonFileExtension(String fileName) { if (fileName != null && !fileName.isEmpty()) { String extension = FilenameUtils.getExtension(fileName); if (JSON_FILE_EXTENSION.equalsIgnoreCase(extension)) { return Boolean.TRUE; } } return Boolean.FALSE; } @Overr... | OfflineDataProcessingExecutor extends TimerTask { public Boolean hasJsonFileExtension(String fileName) { if (fileName != null && !fileName.isEmpty()) { String extension = FilenameUtils.getExtension(fileName); if (JSON_FILE_EXTENSION.equalsIgnoreCase(extension)) { return Boolean.TRUE; } } return Boolean.FALSE; } @Overr... |
@Test public void testProcessOfflineConfiguration() { File configFile = new File(ConfigOptions.OFFLINE_DATA_PROCESSING_RESOLVED_PATH + ConfigOptions.FILE_SEPERATOR + ConfigOptions.DATA_ENRICHMENT_TEMPLATE); Boolean resultFlag = executor.processOfflineConfiguration(configFile); assertTrue(resultFlag); } | public Boolean processOfflineConfiguration(File jsonFile) { try { try (BufferedReader reader = new BufferedReader(new FileReader(jsonFile))) { DataEnrichmentModel[] dataEnrichmentModelArray = new Gson().fromJson(reader, DataEnrichmentModel[].class); List<DataEnrichmentModel> dataEnrichmentModels = Arrays.asList(dataEnr... | OfflineDataProcessingExecutor extends TimerTask { public Boolean processOfflineConfiguration(File jsonFile) { try { try (BufferedReader reader = new BufferedReader(new FileReader(jsonFile))) { DataEnrichmentModel[] dataEnrichmentModelArray = new Gson().fromJson(reader, DataEnrichmentModel[].class); List<DataEnrichmentM... | OfflineDataProcessingExecutor extends TimerTask { public Boolean processOfflineConfiguration(File jsonFile) { try { try (BufferedReader reader = new BufferedReader(new FileReader(jsonFile))) { DataEnrichmentModel[] dataEnrichmentModelArray = new Gson().fromJson(reader, DataEnrichmentModel[].class); List<DataEnrichmentM... | OfflineDataProcessingExecutor extends TimerTask { public Boolean processOfflineConfiguration(File jsonFile) { try { try (BufferedReader reader = new BufferedReader(new FileReader(jsonFile))) { DataEnrichmentModel[] dataEnrichmentModelArray = new Gson().fromJson(reader, DataEnrichmentModel[].class); List<DataEnrichmentM... | OfflineDataProcessingExecutor extends TimerTask { public Boolean processOfflineConfiguration(File jsonFile) { try { try (BufferedReader reader = new BufferedReader(new FileReader(jsonFile))) { DataEnrichmentModel[] dataEnrichmentModelArray = new Gson().fromJson(reader, DataEnrichmentModel[].class); List<DataEnrichmentM... |
@Test public void testUpdateLastExecutionTime() { DataEnrichmentModel dataEnrichmentModel = new DataEnrichmentModel(); dataEnrichmentModel.setLastExecutionTime("2018/07/16 12:53 PM"); DataEnrichmentModel resultModel = executor.updateLastExecutionTime(dataEnrichmentModel); String currentTime = InsightsUtils.getLocalDate... | public DataEnrichmentModel updateLastExecutionTime(DataEnrichmentModel dataEnrichmentModel) { String lastRunTime = InsightsUtils.getLocalDateTime(DATE_TIME_FORMAT); if (dataEnrichmentModel != null) { dataEnrichmentModel.setLastExecutionTime(lastRunTime); } return dataEnrichmentModel; } | OfflineDataProcessingExecutor extends TimerTask { public DataEnrichmentModel updateLastExecutionTime(DataEnrichmentModel dataEnrichmentModel) { String lastRunTime = InsightsUtils.getLocalDateTime(DATE_TIME_FORMAT); if (dataEnrichmentModel != null) { dataEnrichmentModel.setLastExecutionTime(lastRunTime); } return dataEn... | OfflineDataProcessingExecutor extends TimerTask { public DataEnrichmentModel updateLastExecutionTime(DataEnrichmentModel dataEnrichmentModel) { String lastRunTime = InsightsUtils.getLocalDateTime(DATE_TIME_FORMAT); if (dataEnrichmentModel != null) { dataEnrichmentModel.setLastExecutionTime(lastRunTime); } return dataEn... | OfflineDataProcessingExecutor extends TimerTask { public DataEnrichmentModel updateLastExecutionTime(DataEnrichmentModel dataEnrichmentModel) { String lastRunTime = InsightsUtils.getLocalDateTime(DATE_TIME_FORMAT); if (dataEnrichmentModel != null) { dataEnrichmentModel.setLastExecutionTime(lastRunTime); } return dataEn... | OfflineDataProcessingExecutor extends TimerTask { public DataEnrichmentModel updateLastExecutionTime(DataEnrichmentModel dataEnrichmentModel) { String lastRunTime = InsightsUtils.getLocalDateTime(DATE_TIME_FORMAT); if (dataEnrichmentModel != null) { dataEnrichmentModel.setLastExecutionTime(lastRunTime); } return dataEn... |
@Test public void testUpdateLastExecutionTimeNegative() { DataEnrichmentModel dataEnrichmentModel = new DataEnrichmentModel(); dataEnrichmentModel.setLastExecutionTime("2018/07/16 12:53 PM"); DataEnrichmentModel resultModel = executor.updateLastExecutionTime(dataEnrichmentModel); String randomTime = "2018/07/16 05:50 P... | public DataEnrichmentModel updateLastExecutionTime(DataEnrichmentModel dataEnrichmentModel) { String lastRunTime = InsightsUtils.getLocalDateTime(DATE_TIME_FORMAT); if (dataEnrichmentModel != null) { dataEnrichmentModel.setLastExecutionTime(lastRunTime); } return dataEnrichmentModel; } | OfflineDataProcessingExecutor extends TimerTask { public DataEnrichmentModel updateLastExecutionTime(DataEnrichmentModel dataEnrichmentModel) { String lastRunTime = InsightsUtils.getLocalDateTime(DATE_TIME_FORMAT); if (dataEnrichmentModel != null) { dataEnrichmentModel.setLastExecutionTime(lastRunTime); } return dataEn... | OfflineDataProcessingExecutor extends TimerTask { public DataEnrichmentModel updateLastExecutionTime(DataEnrichmentModel dataEnrichmentModel) { String lastRunTime = InsightsUtils.getLocalDateTime(DATE_TIME_FORMAT); if (dataEnrichmentModel != null) { dataEnrichmentModel.setLastExecutionTime(lastRunTime); } return dataEn... | OfflineDataProcessingExecutor extends TimerTask { public DataEnrichmentModel updateLastExecutionTime(DataEnrichmentModel dataEnrichmentModel) { String lastRunTime = InsightsUtils.getLocalDateTime(DATE_TIME_FORMAT); if (dataEnrichmentModel != null) { dataEnrichmentModel.setLastExecutionTime(lastRunTime); } return dataEn... | OfflineDataProcessingExecutor extends TimerTask { public DataEnrichmentModel updateLastExecutionTime(DataEnrichmentModel dataEnrichmentModel) { String lastRunTime = InsightsUtils.getLocalDateTime(DATE_TIME_FORMAT); if (dataEnrichmentModel != null) { dataEnrichmentModel.setLastExecutionTime(lastRunTime); } return dataEn... |
@Test public void testFindInterfaceMethods(){ Method[] findInterfaceMethods = httpMatch.findInterfaceMethods("login"); Assert.assertEquals(findInterfaceMethods.length, 2); findInterfaceMethods = httpMatch.findInterfaceMethods("get"); Assert.assertEquals(findInterfaceMethods.length, 2); findInterfaceMethods = httpMatch.... | public Method[] findInterfaceMethods(String methodName) { Method[] methods = interfaceClass.getMethods(); List<Method> ret = new ArrayList<Method>(); for (Method method : methods) { if (method.getName().equals(methodName)) ret.add(method); } return ret.toArray(new Method[] {}); } | HttpMatch { public Method[] findInterfaceMethods(String methodName) { Method[] methods = interfaceClass.getMethods(); List<Method> ret = new ArrayList<Method>(); for (Method method : methods) { if (method.getName().equals(methodName)) ret.add(method); } return ret.toArray(new Method[] {}); } } | HttpMatch { public Method[] findInterfaceMethods(String methodName) { Method[] methods = interfaceClass.getMethods(); List<Method> ret = new ArrayList<Method>(); for (Method method : methods) { if (method.getName().equals(methodName)) ret.add(method); } return ret.toArray(new Method[] {}); } HttpMatch(Class<?> interfac... | HttpMatch { public Method[] findInterfaceMethods(String methodName) { Method[] methods = interfaceClass.getMethods(); List<Method> ret = new ArrayList<Method>(); for (Method method : methods) { if (method.getName().equals(methodName)) ret.add(method); } return ret.toArray(new Method[] {}); } HttpMatch(Class<?> interfac... | HttpMatch { public Method[] findInterfaceMethods(String methodName) { Method[] methods = interfaceClass.getMethods(); List<Method> ret = new ArrayList<Method>(); for (Method method : methods) { if (method.getName().equals(methodName)) ret.add(method); } return ret.toArray(new Method[] {}); } HttpMatch(Class<?> interfac... |
@Test public void testFindRefMethods() throws NoSuchMethodException, SecurityException{ Method[] findInterfaceMethods = httpMatch.findInterfaceMethods("login"); Assert.assertEquals(findInterfaceMethods.length, 2); Method[] findRefMethods = httpMatch.findRefMethods(findInterfaceMethods, null, "POST"); Assert.assertEqual... | public Method[] findRefMethods(Method[] interfaceMethods, String operationId, String requestMethod) { List<Method> ret = new ArrayList<Method>(); for (Method method : interfaceMethods) { Method m; try { m = refClass.getMethod(method.getName(), method.getParameterTypes()); final ApiOperation apiOperation = ReflectionUti... | HttpMatch { public Method[] findRefMethods(Method[] interfaceMethods, String operationId, String requestMethod) { List<Method> ret = new ArrayList<Method>(); for (Method method : interfaceMethods) { Method m; try { m = refClass.getMethod(method.getName(), method.getParameterTypes()); final ApiOperation apiOperation = R... | HttpMatch { public Method[] findRefMethods(Method[] interfaceMethods, String operationId, String requestMethod) { List<Method> ret = new ArrayList<Method>(); for (Method method : interfaceMethods) { Method m; try { m = refClass.getMethod(method.getName(), method.getParameterTypes()); final ApiOperation apiOperation = R... | HttpMatch { public Method[] findRefMethods(Method[] interfaceMethods, String operationId, String requestMethod) { List<Method> ret = new ArrayList<Method>(); for (Method method : interfaceMethods) { Method m; try { m = refClass.getMethod(method.getName(), method.getParameterTypes()); final ApiOperation apiOperation = R... | HttpMatch { public Method[] findRefMethods(Method[] interfaceMethods, String operationId, String requestMethod) { List<Method> ret = new ArrayList<Method>(); for (Method method : interfaceMethods) { Method m; try { m = refClass.getMethod(method.getName(), method.getParameterTypes()); final ApiOperation apiOperation = R... |
@SuppressWarnings({ "serial" }) @Test public void testApplyParameters(){ Swagger swagger = new Swagger(); Reader.read(swagger, new HashMap<Class<?>, Object>(){{ put(InterfaceServiceTest.class, new InterfaceServiceImplTest()); }}, "/h"); Map<String, Path> paths = swagger.getPaths(); Assert.assertEquals(paths.size(), 4);... | public static void read(Swagger swagger, Set<Class<?>> classes) { final Reader reader = new Reader(swagger); for (Class<?> cls : classes) { final ReaderContext context = new ReaderContext(swagger, cls, cls, "", null, false, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), new ArrayList<Paramet... | Reader { public static void read(Swagger swagger, Set<Class<?>> classes) { final Reader reader = new Reader(swagger); for (Class<?> cls : classes) { final ReaderContext context = new ReaderContext(swagger, cls, cls, "", null, false, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), new ArrayLis... | Reader { public static void read(Swagger swagger, Set<Class<?>> classes) { final Reader reader = new Reader(swagger); for (Class<?> cls : classes) { final ReaderContext context = new ReaderContext(swagger, cls, cls, "", null, false, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), new ArrayLis... | Reader { public static void read(Swagger swagger, Set<Class<?>> classes) { final Reader reader = new Reader(swagger); for (Class<?> cls : classes) { final ReaderContext context = new ReaderContext(swagger, cls, cls, "", null, false, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), new ArrayLis... | Reader { public static void read(Swagger swagger, Set<Class<?>> classes) { final Reader reader = new Reader(swagger); for (Class<?> cls : classes) { final ReaderContext context = new ReaderContext(swagger, cls, cls, "", null, false, new ArrayList<String>(), new ArrayList<String>(), new ArrayList<String>(), new ArrayLis... |
@Test public void fetchUsers_sucess(){ mPresenter.fetchUsers(); verify(mRepository, times(1)).fetchUsers(2); } | @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getScheduler().ui()) .subscribe( userResponse -> { this.getView().onLoading(false); this.getView()... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... |
@Test public void fetchUsers_returning_loadingSuccess_forView() { mPresenter.fetchUsers(); verify(mView, times(1)).getPage(); verify(mView, times(1)).onLoading(true); mTestScheduler.triggerActions(); verify(mView, times(1)).onLoading(false); } | @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getScheduler().ui()) .subscribe( userResponse -> { this.getView().onLoading(false); this.getView()... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... |
@Test public void fetchUsers_returningSuccess_forView() { mPresenter.fetchUsers(); mTestScheduler.triggerActions(); verify(mView, times(1)).onUserResponse(mUserResponse); verify(mView, never()).onError(null); } | @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getScheduler().ui()) .subscribe( userResponse -> { this.getView().onLoading(false); this.getView()... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... |
@Test public void fetchUsers_returningFailing_forView() { Throwable throwable = new Throwable(); when(mRepository.fetchUsers(2)).thenReturn(Single.error(throwable)); mPresenter.fetchUsers(); mTestScheduler.triggerActions(); verify(mView).onError(throwable); verify(mView, times(1)).onLoading(false); verify(mView, never(... | @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getScheduler().ui()) .subscribe( userResponse -> { this.getView().onLoading(false); this.getView()... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public void fetchUsers() { if (this.getView() != null) { this.getView().onLoading(true); this.addDisposable(mRepository.fetchUsers(this.getView().getPage()). subscribeOn(this.getScheduler().io()) .observeOn(this.getSche... |
@Test public void attach_isNotNull_sucess(){ assertNotNull(mPresenter.getView()); } | @Override public HomeContract.View getView() { return super.getView(); } | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public HomeContract.View getView() { return super.getView(); } } | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public HomeContract.View getView() { return super.getView(); } @Inject HomePresenter(@NonNull HomeContract.Repository repository,
@NonNull BaseScheduler scheduler); } | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public HomeContract.View getView() { return super.getView(); } @Inject HomePresenter(@NonNull HomeContract.Repository repository,
@NonNull BaseScheduler scheduler); @Override void fetchUsers();... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public HomeContract.View getView() { return super.getView(); } @Inject HomePresenter(@NonNull HomeContract.Repository repository,
@NonNull BaseScheduler scheduler); @Override void fetchUsers();... |
@Test public void detachView_isNull_sucess(){ assertNotNull(mPresenter.getView()); mPresenter.detachView(); assertNull(mPresenter.getView()); } | @Override public HomeContract.View getView() { return super.getView(); } | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public HomeContract.View getView() { return super.getView(); } } | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public HomeContract.View getView() { return super.getView(); } @Inject HomePresenter(@NonNull HomeContract.Repository repository,
@NonNull BaseScheduler scheduler); } | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public HomeContract.View getView() { return super.getView(); } @Inject HomePresenter(@NonNull HomeContract.Repository repository,
@NonNull BaseScheduler scheduler); @Override void fetchUsers();... | HomePresenter extends BasePresenter<HomeContract.View> implements HomeContract.Presenter { @Override public HomeContract.View getView() { return super.getView(); } @Inject HomePresenter(@NonNull HomeContract.Repository repository,
@NonNull BaseScheduler scheduler); @Override void fetchUsers();... |
@Test public void fetchUsers_sucess() { mRepository.fetchUsers(2); verify(mApiEndPointHelper).fetchUsers(2); } | @Override public Single<UserResponse> fetchUsers(int page) { return this.endPointHelper.fetchUsers(page); } | HomeRepository implements HomeContract.Repository { @Override public Single<UserResponse> fetchUsers(int page) { return this.endPointHelper.fetchUsers(page); } } | HomeRepository implements HomeContract.Repository { @Override public Single<UserResponse> fetchUsers(int page) { return this.endPointHelper.fetchUsers(page); } @Inject HomeRepository(EndPointHelper endPointHelper); } | HomeRepository implements HomeContract.Repository { @Override public Single<UserResponse> fetchUsers(int page) { return this.endPointHelper.fetchUsers(page); } @Inject HomeRepository(EndPointHelper endPointHelper); @Override Single<UserResponse> fetchUsers(int page); } | HomeRepository implements HomeContract.Repository { @Override public Single<UserResponse> fetchUsers(int page) { return this.endPointHelper.fetchUsers(page); } @Inject HomeRepository(EndPointHelper endPointHelper); @Override Single<UserResponse> fetchUsers(int page); } |
@Test public void fetchUsers_noErros_sucess() { TestObserver<UserResponse> subscriber = TestObserver.create(); mApiEndPointHelper.fetchUsers(2).subscribe(subscriber); subscriber.onNext(new UserResponse()); subscriber.assertNoErrors(); subscriber.assertComplete(); } | @Override public Single<UserResponse> fetchUsers(int page) { return this.endPointHelper.fetchUsers(page); } | HomeRepository implements HomeContract.Repository { @Override public Single<UserResponse> fetchUsers(int page) { return this.endPointHelper.fetchUsers(page); } } | HomeRepository implements HomeContract.Repository { @Override public Single<UserResponse> fetchUsers(int page) { return this.endPointHelper.fetchUsers(page); } @Inject HomeRepository(EndPointHelper endPointHelper); } | HomeRepository implements HomeContract.Repository { @Override public Single<UserResponse> fetchUsers(int page) { return this.endPointHelper.fetchUsers(page); } @Inject HomeRepository(EndPointHelper endPointHelper); @Override Single<UserResponse> fetchUsers(int page); } | HomeRepository implements HomeContract.Repository { @Override public Single<UserResponse> fetchUsers(int page) { return this.endPointHelper.fetchUsers(page); } @Inject HomeRepository(EndPointHelper endPointHelper); @Override Single<UserResponse> fetchUsers(int page); } |
@Test public void testSendMessage() { var wsMockHelper = new WebSocketMockHelper(); getTestByteArrayStream().forEach(bytes -> { try { WsProducer.sendMessage(wsMockHelper.getMock(), bytes, false); assertArrayEquals("sendMessage() (bytes, non-streaming) seems flawed", bytes, wsMockHelper.getResultBytes()); wsMockHelper.r... | public static void sendMessage(WebSocket webSocket, String msg, boolean streaming) { if (streaming && msg.length() > STREAM_BUFFER_SIZE) { int p = 0; while (p < msg.length()) { if (msg.length() - p < STREAM_BUFFER_SIZE) { webSocket.sendContinuationFrame(msg.substring(p), true, 0); p = msg.length(); } else if (p == 0) {... | WsProducer extends DefaultProducer { public static void sendMessage(WebSocket webSocket, String msg, boolean streaming) { if (streaming && msg.length() > STREAM_BUFFER_SIZE) { int p = 0; while (p < msg.length()) { if (msg.length() - p < STREAM_BUFFER_SIZE) { webSocket.sendContinuationFrame(msg.substring(p), true, 0); p... | WsProducer extends DefaultProducer { public static void sendMessage(WebSocket webSocket, String msg, boolean streaming) { if (streaming && msg.length() > STREAM_BUFFER_SIZE) { int p = 0; while (p < msg.length()) { if (msg.length() - p < STREAM_BUFFER_SIZE) { webSocket.sendContinuationFrame(msg.substring(p), true, 0); p... | WsProducer extends DefaultProducer { public static void sendMessage(WebSocket webSocket, String msg, boolean streaming) { if (streaming && msg.length() > STREAM_BUFFER_SIZE) { int p = 0; while (p < msg.length()) { if (msg.length() - p < STREAM_BUFFER_SIZE) { webSocket.sendContinuationFrame(msg.substring(p), true, 0); p... | WsProducer extends DefaultProducer { public static void sendMessage(WebSocket webSocket, String msg, boolean streaming) { if (streaming && msg.length() > STREAM_BUFFER_SIZE) { int p = 0; while (p < msg.length()) { if (msg.length() - p < STREAM_BUFFER_SIZE) { webSocket.sendContinuationFrame(msg.substring(p), true, 0); p... |
@Test public void nonExistentFile() throws Exception { File file = mock(File.class); when(file.exists()).thenReturn(false); assertThatThrownBy(() -> loader.load(file)).isInstanceOf(FileNotFoundException.class); } | @Override @SuppressWarnings("IllegalCatch") public Configuration load(File file) throws FileNotFoundException { if (!file.exists()) { throw new FileNotFoundException("The given file does not exist"); } try { return new DefProConfiguration(APIProvider.getAPI(file.getAbsolutePath())); } catch (Exception e) { throw new Fi... | DefProConfigurationLoader implements ConfigurationLoader { @Override @SuppressWarnings("IllegalCatch") public Configuration load(File file) throws FileNotFoundException { if (!file.exists()) { throw new FileNotFoundException("The given file does not exist"); } try { return new DefProConfiguration(APIProvider.getAPI(fil... | DefProConfigurationLoader implements ConfigurationLoader { @Override @SuppressWarnings("IllegalCatch") public Configuration load(File file) throws FileNotFoundException { if (!file.exists()) { throw new FileNotFoundException("The given file does not exist"); } try { return new DefProConfiguration(APIProvider.getAPI(fil... | DefProConfigurationLoader implements ConfigurationLoader { @Override @SuppressWarnings("IllegalCatch") public Configuration load(File file) throws FileNotFoundException { if (!file.exists()) { throw new FileNotFoundException("The given file does not exist"); } try { return new DefProConfiguration(APIProvider.getAPI(fil... | DefProConfigurationLoader implements ConfigurationLoader { @Override @SuppressWarnings("IllegalCatch") public Configuration load(File file) throws FileNotFoundException { if (!file.exists()) { throw new FileNotFoundException("The given file does not exist"); } try { return new DefProConfiguration(APIProvider.getAPI(fil... |
@Test public void setDestinationFail() { Teleporter vertTeleporter = new Teleporter(new VerticalTrack()); assertThatThrownBy(() -> vertTeleporter.setDestination(teleporter1)) .isInstanceOf(IllegalStateException.class); assertThatThrownBy(() -> teleporter1.setDestination(vertTeleporter)) .isInstanceOf(IllegalStateExcept... | public void setDestination(Teleporter destination) { if (!track.getClass().equals(destination.getTrack().getClass())) { throw new IllegalStateException("Both connected teleporters must be either" + " horizontal or vertical"); } this.destination = destination; } | Teleporter extends Tileable implements TileableListener { public void setDestination(Teleporter destination) { if (!track.getClass().equals(destination.getTrack().getClass())) { throw new IllegalStateException("Both connected teleporters must be either" + " horizontal or vertical"); } this.destination = destination; } ... | Teleporter extends Tileable implements TileableListener { public void setDestination(Teleporter destination) { if (!track.getClass().equals(destination.getTrack().getClass())) { throw new IllegalStateException("Both connected teleporters must be either" + " horizontal or vertical"); } this.destination = destination; } ... | Teleporter extends Tileable implements TileableListener { public void setDestination(Teleporter destination) { if (!track.getClass().equals(destination.getTrack().getClass())) { throw new IllegalStateException("Both connected teleporters must be either" + " horizontal or vertical"); } this.destination = destination; } ... | Teleporter extends Tileable implements TileableListener { public void setDestination(Teleporter destination) { if (!track.getClass().equals(destination.getTrack().getClass())) { throw new IllegalStateException("Both connected teleporters must be either" + " horizontal or vertical"); } this.destination = destination; } ... |
@Test public void informDispose() { Direction direction = Direction.RIGHT; Marble marble = new Marble(MarbleType.BLUE); TileableListener listener = mock(TileableListener.class); teleporter1.addListener(listener); teleporter1.ballDisposed(teleporter1, direction, marble); verify(listener, times(1)).ballDisposed( teleport... | @Override public void ballDisposed(Tileable tileable, Direction direction, Marble marble) { informDispose(direction, marble); } | Teleporter extends Tileable implements TileableListener { @Override public void ballDisposed(Tileable tileable, Direction direction, Marble marble) { informDispose(direction, marble); } } | Teleporter extends Tileable implements TileableListener { @Override public void ballDisposed(Tileable tileable, Direction direction, Marble marble) { informDispose(direction, marble); } Teleporter(Track track); } | Teleporter extends Tileable implements TileableListener { @Override public void ballDisposed(Tileable tileable, Direction direction, Marble marble) { informDispose(direction, marble); } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean... | Teleporter extends Tileable implements TileableListener { @Override public void ballDisposed(Tileable tileable, Direction direction, Marble marble) { informDispose(direction, marble); } Teleporter(Track track); void setDestination(Teleporter destination); Track getTrack(); Teleporter getDestination(); @Override boolean... |
@Test public void isNotConnected() { Grid grid = new Grid(null, 1, 1); grid.place(0, 0, track); assertThat(track.isConnected()).isFalse(); } | public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } } | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } } | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } boolean isConnected(); ... | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } boolean isConnected(); ... |
@Test public void isNotConnectedLeft() { Grid grid = new Grid(null, 2, 1); grid.place(0, 0, new HorizontalTrack()); grid.place(1, 0, track); assertThat(track.isConnected()).isFalse(); } | public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } } | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } } | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } boolean isConnected(); ... | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } boolean isConnected(); ... |
@Test public void isNotConnectedRight() { Grid grid = new Grid(null, 2, 1); grid.place(0, 0, track); grid.place(1, 0, new HorizontalTrack()); assertThat(track.isConnected()).isFalse(); } | public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } } | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } } | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } boolean isConnected(); ... | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } boolean isConnected(); ... |
@Test public void unplacedNotConnected() { assertThatThrownBy(() -> track.isConnected()).isInstanceOf(IllegalStateException.class); } | public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } } | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } } | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } boolean isConnected(); ... | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } boolean isConnected(); ... |
@Test public void isConnected() { HorizontalTrack hz1 = new HorizontalTrack(); HorizontalTrack hz2 = new HorizontalTrack(); Grid grid = new Grid(null, 3, 1); grid.place(0, 0, hz1); grid.place(1, 0, track); grid.place(2, 0, hz2); assertThat(track.isConnected()).isTrue(); } | public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } } | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } } | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } boolean isConnected(); ... | HorizontalTrack extends Track { public boolean isConnected() { Tile tile = getTile(); if (tile == null) { throw new IllegalStateException("The track is not placed on a grid"); } Tile left = tile.get(Direction.LEFT); Tile right = tile.get(Direction.RIGHT); return left != null && right != null; } boolean isConnected(); ... |
@Test public void allowsLeft() { assertThat(track.allowsConnection(Direction.LEFT)).isTrue(); } | @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } } | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } } | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction ... | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction ... |
@Test public void allowsRight() { assertThat(track.allowsConnection(Direction.RIGHT)).isTrue(); } | @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } } | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } } | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction ... | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction ... |
@Test public void disallowsTop() { assertThat(track.allowsConnection(Direction.TOP)).isFalse(); } | @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } } | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } } | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction ... | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction ... |
@Test public void getDefaultBooleanProperty() throws Exception { when(api.getBooleanValueOf(anyString())).thenThrow(new NotExistingVariableException("")); assertThat(config.get(new BooleanProperty("a", false))).isFalse(); } | @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value; if (property instanceof ListProperty) { ListProperty listProperty = (ListProperty) property; value = getList(listProperty); } else { value =... | DefProConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value; if (property instanceof ListProperty) { ListProperty listProperty = (ListProperty) property; ... | DefProConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value; if (property instanceof ListProperty) { ListProperty listProperty = (ListProperty) property; ... | DefProConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value; if (property instanceof ListProperty) { ListProperty listProperty = (ListProperty) property; ... | DefProConfiguration implements Configuration { @Override @SuppressWarnings("unchecked") public <T> T get(Property<T> property, T defaultValue) { Class<T> type = property.getType(); String key = property.getKey(); Object value; if (property instanceof ListProperty) { ListProperty listProperty = (ListProperty) property; ... |
@Test public void disallowsBottom() { assertThat(track.allowsConnection(Direction.BOTTOM)).isFalse(); } | @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } } | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } } | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction ... | HorizontalTrack extends Track { @Override public boolean allowsConnection(Direction direction) { switch (direction) { case LEFT: case RIGHT: return true; default: return false; } } boolean isConnected(); @Override boolean passesMidpoint(Direction direction, Marble marble); @Override boolean allowsConnection(Direction ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.