Question: Please write an acceptance test for the code below: public static List getAllWorldNames ( Connection connection ) { List worldNames; worldNames = readData ( connection
Please write an acceptance test for the code below:
public static List getAllWorldNamesConnection connection
List worldNames;
worldNames readDataconnection;
return worldNames;
public static List readDatafinal Connection connection
List worldNames new ArrayList;
try final PreparedStatement stmt connection.prepareStatement
"SELECT name FROM worlds"
final boolean gotAResultSet stmtexecute;
if gotAResultSet
throw new RuntimeExceptionExpected a SQL resultset, but we got an update count instead!";
try ResultSet results stmtgetResultSet
while resultsnext
final String worldName results.getStringnametoLowerCase;
worldNames.addworldName;
catch SQLException e
throw new RuntimeExceptione;
return worldNames;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
