@SuppressWarnings("unchecked") @Test public void testConvertMapString() { Map m = new HashMap(); User u = new User(); m.put("userId", 1); m.put("email", "*****@*****.**"); m.put("alias", "Jack"); User u1 = (User) TribusObjectMapping.convert(m, "model.User"); Assert.assertEquals(1, u1.getUserId()); Assert.assertEquals("*****@*****.**", u1.getUserEmail()); Assert.assertEquals("Jack", u1.getUserAlias()); // fail("Not yet implemented"); }
public void insertValues(User user) { try { stmt = conn.createStatement(); String sql = "INSERT INTO user values('" + user.getUserId() + "','" + user.getUserEmail() + "','" + user.getPassword() + "','" + user.getRole() + "')"; stmt.execute(sql); } catch (Exception e) { e.printStackTrace(); } }