### Question:
SubscriptionService implements SubscriptionManager { @Override public Subscription updateSubscription(SubscriptionRequest subscriptionRequest) throws ResponseException { Subscription subscription = subscriptionRequest.getSubscription(); Subscription oldSub = subscriptionId2Subscription.get(subscription.getId().toString()); if (oldSub == null) { throw new ResponseException(ErrorType.NotFound); } if (subscription.getAttributeNames() != null) { oldSub.setAttributeNames(subscription.getAttributeNames()); } if (subscription.getDescription() != null) { oldSub.setDescription(subscription.getDescription()); } if (subscription.getEntities() != null && !subscription.getEntities().isEmpty()) { oldSub.setEntities(subscription.getEntities()); } if (subscription.getExpires() != null) { oldSub.setExpires(subscription.getExpires()); synchronized (subId2TimerTask) { TimerTask task = subId2TimerTask.get(oldSub.getId().toString()); task.cancel(); watchDog.schedule(task, subscription.getExpires() - System.currentTimeMillis()); } } if (subscription.getLdGeoQuery() != null) { oldSub.setLdGeoQuery(subscription.getLdGeoQuery()); } if (subscription.getLdQuery() != null) { oldSub.setLdQuery(subscription.getLdQuery()); } if (subscription.getLdTempQuery() != null) { oldSub.setLdTempQuery(subscription.getLdTempQuery()); } if (subscription.getNotification() != null) { oldSub.setNotification(subscription.getNotification()); } if (subscription.getThrottling() != 0) { oldSub.setThrottling(subscription.getThrottling()); } if (subscription.getTimeInterval() != 0) { oldSub.setTimeInterval(subscription.getTimeInterval()); } synchronized (this.subscriptionId2Context) { this.subscriptionId2Context.putAll(oldSub.getId().toString(), subscriptionRequest.getContext()); } return oldSub; } SubscriptionService(); @Override URI subscribe(SubscriptionRequest subscriptionRequest); @Override void unsubscribe(URI id); @Override Subscription updateSubscription(SubscriptionRequest subscriptionRequest); @Override List<Subscription> getAllSubscriptions(int limit); @Override Subscription getSubscription(String subscriptionId); @KafkaListener(topics = "${entity.create.topic}", groupId = "submanager") void handleCreate(Message<byte[]> message); @KafkaListener(topics = "${entity.update.topic}", groupId = "submanager") void handleUpdate(Message<byte[]> message); @KafkaListener(topics = "${entity.append.topic}", groupId = "submanager") void handleAppend(Message<byte[]> message); @KafkaListener(topics = "${entity.delete.topic}", groupId = "submanager") void handleDelete(Message<byte[]> message); @KafkaListener(topics = "${csource.notification.topic}", groupId = "submanager") void handleCSourceNotification(Message<byte[]> message); @Override void remoteNotify(String id, Notification notification); void reportNotification(String subId, Long now); void reportFailedNotification(String subId, Long now); void reportSuccessfulNotification(String subId, Long now);  }### Answer:
@Test public void updateSubscriptionTest() { List<Object> context = new ArrayList<>(); Subscription subscription = null; subscription = DataSerializer.getSubscription(resolved); SubscriptionRequest subRequest = new SubscriptionRequest(subscription, context); when(subscriptionId2Subscription.get(any())).thenReturn(new Subscription()); try { manager.updateSubscription(subRequest); } catch (Exception e) { verify(subscriptionId2Subscription,times(1)).get(any()); } }