Skip to content
Snippets Groups Projects
Commit ccdf6a43 authored by Kissiedu, Isaiah (UG - Computer Science)'s avatar Kissiedu, Isaiah (UG - Computer Science)
Browse files

Update CustomerTest.java

parent fe15523f
No related branches found
No related tags found
No related merge requests found
package com1028test; package com1028test;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import java.sql.*; import java.sql.*;
import java.util.ArrayList; import java.util.ArrayList;
import org.junit.Test; import org.junit.Test;
import com1028.Orders; import com1028.Orders;
import com1028.BaseQuery; import com1028.BaseQuery;
import com1028.Customer; import com1028.Customer;
public class CustomerTest { public class CustomerTest {
@Test @Test
public void testReq2() throws Exception { public void testReq2() throws Exception {
try { try {
Connection myConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/classicmodels", "root", "googleplex"); Connection myConn = DriverManager.getConnection("jdbc:mysql://localhost:3306/classicmodels", "root", "");
Customer customers = new Customer(); Customer customers = new Customer();
customers.setCustomerNumber(2); customers.setCustomerNumber(2);
Statement stmt = myConn.createStatement(); Statement stmt = myConn.createStatement();
ArrayList<Customer> n = new ArrayList<>(); ArrayList<Customer> n = new ArrayList<>();
ResultSet rs = stmt.executeQuery("select * FROM payments INNER JOIN customers ON payments.customerNumber = customers.customerNumber"); ResultSet rs = stmt.executeQuery("select * FROM payments INNER JOIN customers ON payments.customerNumber = customers.customerNumber");
String m = null; String m = null;
while(rs.next()) { while(rs.next()) {
m = rs.getString(1); m = rs.getString(1);
} }
assertEquals(m,customers.getCustomerNumber()); assertEquals(m,customers.getCustomerNumber());
} }
catch (Exception exc) { catch (Exception exc) {
exc.printStackTrace (); exc.printStackTrace ();
} }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment