@Test public void updateSubscriptionWithExceptionTest() throws URISyntaxException, SubscriptionPersistenceException { thrown.expect(SubscriptionPersistenceException.class); Subscription subscription = new Subscription(); subscription.setSubscribeContext(new SubscribeContext()); subscriptionsRepository.updateSubscription(subscription); }
public void updateSubscription(Subscription subscription) throws SubscriptionPersistenceException { try { ObjectWriter writer = mapper.writer(); String susbcribeContextString = writer.writeValueAsString(subscription.getSubscribeContext()); String expirationDate = subscription.getExpirationDate().toString(); jdbcTemplate.update("update t_subscriptions set expirationDate=? , subscribeContext=? where id=?", expirationDate, susbcribeContextString, subscription.getSubscriptionId()); } catch (Exception e) { throw new SubscriptionPersistenceException(e); } }
SubscriptionsRepository { public void updateSubscription(Subscription subscription) throws SubscriptionPersistenceException { try { ObjectWriter writer = mapper.writer(); String susbcribeContextString = writer.writeValueAsString(subscription.getSubscribeContext()); String expirationDate = subscription.getExpirationDate().toString(); jdbcTemplate.update("update t_subscriptions set expirationDate=? , subscribeContext=? where id=?", expirationDate, susbcribeContextString, subscription.getSubscriptionId()); } catch (Exception e) { throw new SubscriptionPersistenceException(e); } } }
SubscriptionsRepository { public void updateSubscription(Subscription subscription) throws SubscriptionPersistenceException { try { ObjectWriter writer = mapper.writer(); String susbcribeContextString = writer.writeValueAsString(subscription.getSubscribeContext()); String expirationDate = subscription.getExpirationDate().toString(); jdbcTemplate.update("update t_subscriptions set expirationDate=? , subscribeContext=? where id=?", expirationDate, susbcribeContextString, subscription.getSubscriptionId()); } catch (Exception e) { throw new SubscriptionPersistenceException(e); } }  }
SubscriptionsRepository { public void updateSubscription(Subscription subscription) throws SubscriptionPersistenceException { try { ObjectWriter writer = mapper.writer(); String susbcribeContextString = writer.writeValueAsString(subscription.getSubscribeContext()); String expirationDate = subscription.getExpirationDate().toString(); jdbcTemplate.update("update t_subscriptions set expirationDate=? , subscribeContext=? where id=?", expirationDate, susbcribeContextString, subscription.getSubscriptionId()); } catch (Exception e) { throw new SubscriptionPersistenceException(e); } }  void saveSubscription(Subscription subscription); void updateSubscription(Subscription subscription); Map<String, Subscription> getAllSubscriptions(); void removeSubscription(String subscriptionId); }
SubscriptionsRepository { public void updateSubscription(Subscription subscription) throws SubscriptionPersistenceException { try { ObjectWriter writer = mapper.writer(); String susbcribeContextString = writer.writeValueAsString(subscription.getSubscribeContext()); String expirationDate = subscription.getExpirationDate().toString(); jdbcTemplate.update("update t_subscriptions set expirationDate=? , subscribeContext=? where id=?", expirationDate, susbcribeContextString, subscription.getSubscriptionId()); } catch (Exception e) { throw new SubscriptionPersistenceException(e); } }  void saveSubscription(Subscription subscription); void updateSubscription(Subscription subscription); Map<String, Subscription> getAllSubscriptions(); void removeSubscription(String subscriptionId);  }