use of com.google.testing.compile.CompileTester.UnsuccessfulCompilationClause in project neo4j by neo4j.
the class ProcedureProcessorTest method fails_if_context_injected_fields_have_wrong_modifiers.
@Test
public void fails_if_context_injected_fields_have_wrong_modifiers() {
JavaFileObject sproc = JavaFileObjectUtils.INSTANCE.procedureSource("invalid/bad_context_field/BadContextSproc.java");
UnsuccessfulCompilationClause unsuccessfulCompilationClause = assert_().about(javaSource()).that(sproc).processedWith(processor).failsToCompile().withErrorCount(4);
unsuccessfulCompilationClause.withErrorContaining("@org.neo4j.procedure.Context usage error: field BadContextSproc#shouldBeNonStatic should be public, non-static and non-final").in(sproc).onLine(30);
unsuccessfulCompilationClause.withErrorContaining("@org.neo4j.procedure.Context usage error: field BadContextSproc#shouldBeNonFinal should be public, non-static and non-final").in(sproc).onLine(33);
unsuccessfulCompilationClause.withErrorContaining("@org.neo4j.procedure.Context usage error: field BadContextSproc#shouldBePublic should be public, non-static and non-final").in(sproc).onLine(37);
unsuccessfulCompilationClause.withErrorContaining("Field BadContextSproc#shouldBeStatic should be static").in(sproc).onLine(38);
}
use of com.google.testing.compile.CompileTester.UnsuccessfulCompilationClause in project neo4j by neo4j.
the class ProcedureProcessorTest method fails_if_record_type_has_nonpublic_fields.
@Test
public void fails_if_record_type_has_nonpublic_fields() {
JavaFileObject record = JavaFileObjectUtils.INSTANCE.procedureSource("invalid/bad_record_type/BadRecord.java");
UnsuccessfulCompilationClause compilation = assert_().about(javaSources()).that(asList(JavaFileObjectUtils.INSTANCE.procedureSource("invalid/bad_record_type/BadRecordTypeSproc.java"), record)).processedWith(processor).failsToCompile().withErrorCount(2);
compilation.withErrorContaining("Record definition error: field BadRecord#label must be public").in(record).onLine(26);
compilation.withErrorContaining("Record definition error: field BadRecord#age must be public").in(record).onLine(27);
}
use of com.google.testing.compile.CompileTester.UnsuccessfulCompilationClause in project neo4j by neo4j.
the class ProcedureProcessorTest method fails_if_procedure_generic_record_field_type_is_not_supported.
@Test
public void fails_if_procedure_generic_record_field_type_is_not_supported() {
JavaFileObject record = JavaFileObjectUtils.INSTANCE.procedureSource("invalid/bad_record_field_type/BadRecordGenericFieldType.java");
UnsuccessfulCompilationClause compilation = assert_().about(javaSources()).that(asList(JavaFileObjectUtils.INSTANCE.procedureSource("invalid/bad_record_field_type/BadRecordGenericFieldTypeSproc.java"), record)).processedWith(processor).failsToCompile().withErrorCount(3);
compilation.withErrorContaining("Record definition error: type of field BadRecordGenericFieldType#wrongType1 is not supported").in(record).onLine(34);
compilation.withErrorContaining("Record definition error: type of field BadRecordGenericFieldType#wrongType2 is not supported").in(record).onLine(35);
compilation.withErrorContaining("Record definition error: type of field BadRecordGenericFieldType#wrongType3 is not supported").in(record).onLine(36);
}
use of com.google.testing.compile.CompileTester.UnsuccessfulCompilationClause in project neo4j by neo4j.
the class ProcedureProcessorTest method fails_if_parameters_are_not_properly_annotated.
@Test
public void fails_if_parameters_are_not_properly_annotated() {
JavaFileObject sproc = JavaFileObjectUtils.INSTANCE.procedureSource("invalid/missing_name/MissingNameSproc.java");
UnsuccessfulCompilationClause compilation = assert_().about(javaSource()).that(sproc).processedWith(processor).failsToCompile().withErrorCount(2);
compilation.withErrorContaining("@org.neo4j.procedure.Name usage error: missing on parameter <parameter>").in(sproc).onLine(35);
compilation.withErrorContaining("@org.neo4j.procedure.Name usage error: missing on parameter <otherParam>").in(sproc).onLine(35);
}
use of com.google.testing.compile.CompileTester.UnsuccessfulCompilationClause in project neo4j by neo4j.
the class ProcedureProcessorTest method fails_if_procedure_generic_input_type_is_not_supported.
@Test
public void fails_if_procedure_generic_input_type_is_not_supported() {
JavaFileObject sproc = JavaFileObjectUtils.INSTANCE.procedureSource("invalid/bad_proc_input_type/BadGenericInputSproc.java");
UnsuccessfulCompilationClause compilation = assert_().about(javaSource()).that(sproc).processedWith(processor).failsToCompile().withErrorCount(3);
compilation.withErrorContaining("Unsupported parameter type " + "<java.util.List<java.util.List<java.util.Map<java.lang.String,java.lang.Thread>>>>" + " of procedure|function BadGenericInputSproc#doSomething").in(sproc).onLine(36);
compilation.withErrorContaining("Unsupported parameter type " + "<java.util.Map<java.lang.String,java.util.List<java.util.concurrent.ExecutorService>>>" + " of procedure|function BadGenericInputSproc#doSomething2").in(sproc).onLine(42);
compilation.withErrorContaining("Unsupported parameter type <java.util.Map> of procedure|function BadGenericInputSproc#doSomething3").in(sproc).onLine(48);
}
Aggregations