@Test public void updateRegistrationWithExceptionTest() throws URISyntaxException, RegistrationPersistenceException { thrown.expect(RegistrationPersistenceException.class); Registration registration = new Registration(); registration.setRegisterContext(new RegisterContext()); registrationsRepository.updateRegistration(registration); }
public void updateRegistration(Registration registration) throws RegistrationPersistenceException { try { ObjectWriter writer = mapper.writer(); RegisterContext registerContext = registration.getRegisterContext(); String registerContextString = writer.writeValueAsString(registerContext); String expirationDate = registration.getExpirationDate().toString(); jdbcTemplate.update("update t_registrations set expirationDate=? , registerContext=? where id=?", expirationDate, registerContextString, registerContext.getRegistrationId()); } catch (Exception e) { throw new RegistrationPersistenceException(e); } }
RegistrationsRepository { public void updateRegistration(Registration registration) throws RegistrationPersistenceException { try { ObjectWriter writer = mapper.writer(); RegisterContext registerContext = registration.getRegisterContext(); String registerContextString = writer.writeValueAsString(registerContext); String expirationDate = registration.getExpirationDate().toString(); jdbcTemplate.update("update t_registrations set expirationDate=? , registerContext=? where id=?", expirationDate, registerContextString, registerContext.getRegistrationId()); } catch (Exception e) { throw new RegistrationPersistenceException(e); } } }
RegistrationsRepository { public void updateRegistration(Registration registration) throws RegistrationPersistenceException { try { ObjectWriter writer = mapper.writer(); RegisterContext registerContext = registration.getRegisterContext(); String registerContextString = writer.writeValueAsString(registerContext); String expirationDate = registration.getExpirationDate().toString(); jdbcTemplate.update("update t_registrations set expirationDate=? , registerContext=? where id=?", expirationDate, registerContextString, registerContext.getRegistrationId()); } catch (Exception e) { throw new RegistrationPersistenceException(e); } }  }
RegistrationsRepository { public void updateRegistration(Registration registration) throws RegistrationPersistenceException { try { ObjectWriter writer = mapper.writer(); RegisterContext registerContext = registration.getRegisterContext(); String registerContextString = writer.writeValueAsString(registerContext); String expirationDate = registration.getExpirationDate().toString(); jdbcTemplate.update("update t_registrations set expirationDate=? , registerContext=? where id=?", expirationDate, registerContextString, registerContext.getRegistrationId()); } catch (Exception e) { throw new RegistrationPersistenceException(e); } }  void saveRegistration(Registration registration); void updateRegistration(Registration registration); Map<String, Registration> getAllRegistrations(); Registration getRegistration(String registrationId); void removeRegistration(String registrationId); }
RegistrationsRepository { public void updateRegistration(Registration registration) throws RegistrationPersistenceException { try { ObjectWriter writer = mapper.writer(); RegisterContext registerContext = registration.getRegisterContext(); String registerContextString = writer.writeValueAsString(registerContext); String expirationDate = registration.getExpirationDate().toString(); jdbcTemplate.update("update t_registrations set expirationDate=? , registerContext=? where id=?", expirationDate, registerContextString, registerContext.getRegistrationId()); } catch (Exception e) { throw new RegistrationPersistenceException(e); } }  void saveRegistration(Registration registration); void updateRegistration(Registration registration); Map<String, Registration> getAllRegistrations(); Registration getRegistration(String registrationId); void removeRegistration(String registrationId);  }