### Question:
CreditCard { public String getNumber() { return number; } CreditCard();  CreditCard(String number, String expiryDate, Integer controlNumber, CreditCardType creditCardType); String getNumber(); void setNumber(String number); String getExpiryDate(); void setExpiryDate(String expiryDate); Integer getControlNumber(); void setControlNumber(Integer controlNumber); CreditCardType getType(); void setType(CreditCardType creditCardType);  }### Answer:
@Test public void shouldCreateACreditCard() throws Exception { CreditCard creditCard = new CreditCard("123412341234", "12/12", 1253, AMERICAN_EXPRESS); tx.begin(); em.persist(creditCard); tx.commit(); assertNotNull(creditCard.getNumber(), "Id should not be null"); String dbCreditCardType = (String) em.createNativeQuery("select creditCardType from CreditCard where number = '123412341234'").getSingleResult(); assertEquals("A", dbCreditCardType, "Should be A for American Express"); }
@Test public void shouldCreateACreditCard() throws Exception { CreditCard creditCard = new CreditCard("123412341234", "12/12", 1253, CreditCardType.AMERICAN_EXPRESS); tx.begin(); em.persist(creditCard); tx.commit(); assertNotNull(creditCard.getNumber(), "Id should not be null"); }