@Test void runSqlEmptyTest() { JUnitGeneratorHelper helper = new JUnitGeneratorHelper(); String expected = "\n" + "private static java.util.ArrayList<java.util.HashMap<java.lang.String, java.lang.String>> runSql(\n" + " java.lang.String query, boolean isUpdate) throws java.sql.SQLException {\n" + " " return null;\n" + "}\n"; assertThat(helper.buildRunSqlEmpty().toString()).isEqualTo(expected); }
public MethodSpec buildRunSqlEmpty() { MethodSpec.Builder runSql = MethodSpec.methodBuilder(METHOD_RUN_SQL) .addModifiers(Modifier.PRIVATE, Modifier.STATIC) .returns(RETURN_TYPE_RUN_SQL) .addParameter(String.class, "query") .addParameter(TypeName.BOOLEAN, "isUpdate") .addException(SQLException.class) .addJavadoc("This method should connect to your database and execute the given query.\n" + "In order for the assertions to work correctly this method must return a list of maps\n" + "in the case that the query succeeds, or null if the query fails. The tests will assert the results.\n\n" + "@param query The query to execute.\n" + "@param isUpdate Whether the query is a data modification statement.\n\n" + "@returns The resulting table, or null if the query is an update.\n"); runSql.addComment("TODO: implement method stub.") .addStatement("return null"); return runSql.build(); }
JUnitGeneratorHelper { public MethodSpec buildRunSqlEmpty() { MethodSpec.Builder runSql = MethodSpec.methodBuilder(METHOD_RUN_SQL) .addModifiers(Modifier.PRIVATE, Modifier.STATIC) .returns(RETURN_TYPE_RUN_SQL) .addParameter(String.class, "query") .addParameter(TypeName.BOOLEAN, "isUpdate") .addException(SQLException.class) .addJavadoc("This method should connect to your database and execute the given query.\n" + "In order for the assertions to work correctly this method must return a list of maps\n" + "in the case that the query succeeds, or null if the query fails. The tests will assert the results.\n\n" + "@param query The query to execute.\n" + "@param isUpdate Whether the query is a data modification statement.\n\n" + "@returns The resulting table, or null if the query is an update.\n"); runSql.addComment("TODO: implement method stub.") .addStatement("return null"); return runSql.build(); } }
JUnitGeneratorHelper { public MethodSpec buildRunSqlEmpty() { MethodSpec.Builder runSql = MethodSpec.methodBuilder(METHOD_RUN_SQL) .addModifiers(Modifier.PRIVATE, Modifier.STATIC) .returns(RETURN_TYPE_RUN_SQL) .addParameter(String.class, "query") .addParameter(TypeName.BOOLEAN, "isUpdate") .addException(SQLException.class) .addJavadoc("This method should connect to your database and execute the given query.\n" + "In order for the assertions to work correctly this method must return a list of maps\n" + "in the case that the query succeeds, or null if the query fails. The tests will assert the results.\n\n" + "@param query The query to execute.\n" + "@param isUpdate Whether the query is a data modification statement.\n\n" + "@returns The resulting table, or null if the query is an update.\n"); runSql.addComment("TODO: implement method stub.") .addStatement("return null"); return runSql.build(); }  }
JUnitGeneratorHelper { public MethodSpec buildRunSqlEmpty() { MethodSpec.Builder runSql = MethodSpec.methodBuilder(METHOD_RUN_SQL) .addModifiers(Modifier.PRIVATE, Modifier.STATIC) .returns(RETURN_TYPE_RUN_SQL) .addParameter(String.class, "query") .addParameter(TypeName.BOOLEAN, "isUpdate") .addException(SQLException.class) .addJavadoc("This method should connect to your database and execute the given query.\n" + "In order for the assertions to work correctly this method must return a list of maps\n" + "in the case that the query succeeds, or null if the query fails. The tests will assert the results.\n\n" + "@param query The query to execute.\n" + "@param isUpdate Whether the query is a data modification statement.\n\n" + "@returns The resulting table, or null if the query is an update.\n"); runSql.addComment("TODO: implement method stub.") .addStatement("return null"); return runSql.build(); }  MethodSpec buildRunSqlImplementation(); MethodSpec buildRunSqlEmpty(); MethodSpec buildMapMaker(); MethodSpec buildGetResultColumns(); }
JUnitGeneratorHelper { public MethodSpec buildRunSqlEmpty() { MethodSpec.Builder runSql = MethodSpec.methodBuilder(METHOD_RUN_SQL) .addModifiers(Modifier.PRIVATE, Modifier.STATIC) .returns(RETURN_TYPE_RUN_SQL) .addParameter(String.class, "query") .addParameter(TypeName.BOOLEAN, "isUpdate") .addException(SQLException.class) .addJavadoc("This method should connect to your database and execute the given query.\n" + "In order for the assertions to work correctly this method must return a list of maps\n" + "in the case that the query succeeds, or null if the query fails. The tests will assert the results.\n\n" + "@param query The query to execute.\n" + "@param isUpdate Whether the query is a data modification statement.\n\n" + "@returns The resulting table, or null if the query is an update.\n"); runSql.addComment("TODO: implement method stub.") .addStatement("return null"); return runSql.build(); }  MethodSpec buildRunSqlImplementation(); MethodSpec buildRunSqlEmpty(); MethodSpec buildMapMaker(); MethodSpec buildGetResultColumns(); static final String METHOD_RUN_SQL; static final ParameterizedTypeName RETURN_TYPE_RUN_SQL; static final String METHOD_MAP_MAKER; static final String METHOD_GET_RESULT_COLUMNS; }