@Test
public void purchaserIsSaved() throws Exception {
// given
Purchaser aPurchaser = aPurchaser()
.withName("New Name CO")
.withAddress("Neue Strasse 7B, 13456 Wunderbar Staedtchen")
.withNip("111-22-33-444")
.build();
// when
service.savePurchaser(aPurchaser);
// then
Purchaser savedPurchaser = em.createQuery("SELECT p FROM Purchaser p WHERE p.name = :name", Purchaser.class)
.setParameter("name", aPurchaser.getName())
.getSingleResult();
assertNotNull(savedPurchaser.getId());
assertEquals(aPurchaser.getName(), savedPurchaser.getName());
assertEquals(aPurchaser.getAddress(), savedPurchaser.getAddress());
assertEquals(aPurchaser.getNip(), savedPurchaser.getNip());
}