test_class.declarator: subscriptionService = new SubscriptionService()
test_class.modifier: @InjectMocks
      private final
test_class.original_string: @InjectMocks
      private final SubscriptionService subscriptionService = new SubscriptionService();
test_class.type: SubscriptionService
test_class.var_name: subscriptionService
test_class.declarator: seyrenRepository
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private SeyrenRepository seyrenRepository;
test_class.type: SeyrenRepository
test_class.var_name: seyrenRepository
test_class.file: services/src/test/java/com/vsct/supervision/notification/service/SubscriptionServiceTest.java
test_class.identifier: SubscriptionServiceTest
test_case.body: @Test
      public void deleteSubscriptionFail() throws Exception {
          when(seyrenRepository.deleteSubscription(TestUtils.DEFAULT_ALARM_ID, TestUtils.DEFAULT_SUBSCRIPTION_ID)).thenReturn(false);
  
          try {
              subscriptionService.deleteSubscription(TestUtils.DEFAULT_ALARM_ID, TestUtils.DEFAULT_SUBSCRIPTION_ID);
          } catch (CerebroException ce) {
              assertEquals(ErrorCode.SUBSCRIPTION_DELETE_ERROR, ce.getErrorCode());
          }
  
          verify(seyrenRepository).deleteSubscription(TestUtils.DEFAULT_ALARM_ID, TestUtils.DEFAULT_SUBSCRIPTION_ID);
          verifyNoMoreInteractions(seyrenRepository);
      }
test_case.class_method_signature: SubscriptionServiceTest.deleteSubscriptionFail()
test_case.full_signature: @Test public void deleteSubscriptionFail()
test_case.identifier: deleteSubscriptionFail
test_case.invocations: thenReturn when deleteSubscription deleteSubscription assertEquals getErrorCode deleteSubscription verify verifyNoMoreInteractions
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void deleteSubscriptionFail()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(SubscriptionService.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(SubscriptionService.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: seyrenRepository
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private SeyrenRepository seyrenRepository;
focal_class.type: SeyrenRepository
focal_class.var_name: seyrenRepository
focal_class.file: services/src/main/java/com/vsct/supervision/notification/service/SubscriptionService.java
focal_class.identifier: SubscriptionService
focal_class.class_method_signature: SubscriptionService.getSubscription(String alarmId, String subscriptionId)
focal_class.full_signature: public Subscription getSubscription(String alarmId, String subscriptionId)
focal_class.identifier: getSubscription
focal_class.modifiers: public
focal_class.parameters: (String alarmId, String subscriptionId)
focal_class.return: Subscription
focal_class.signature: Subscription getSubscription(String alarmId, String subscriptionId)
focal_class.class_method_signature: SubscriptionService.addSubscription(Subscription subscription, String alarmId)
focal_class.full_signature: public void addSubscription(Subscription subscription, String alarmId)
focal_class.identifier: addSubscription
focal_class.modifiers: public
focal_class.parameters: (Subscription subscription, String alarmId)
focal_class.return: void
focal_class.signature: void addSubscription(Subscription subscription, String alarmId)
focal_class.class_method_signature: SubscriptionService.searchSubscription(Subscription subscription, String alarmId)
focal_class.full_signature: public Subscription searchSubscription(Subscription subscription, String alarmId)
focal_class.identifier: searchSubscription
focal_class.modifiers: public
focal_class.parameters: (Subscription subscription, String alarmId)
focal_class.return: Subscription
focal_class.signature: Subscription searchSubscription(Subscription subscription, String alarmId)
focal_class.class_method_signature: SubscriptionService.updateSubscription(Subscription subscription, String alarmId)
focal_class.full_signature: public void updateSubscription(Subscription subscription, String alarmId)
focal_class.identifier: updateSubscription
focal_class.modifiers: public
focal_class.parameters: (Subscription subscription, String alarmId)
focal_class.return: void
focal_class.signature: void updateSubscription(Subscription subscription, String alarmId)
focal_class.class_method_signature: SubscriptionService.validateSubscription(Subscription subscription)
focal_class.full_signature: private void validateSubscription(Subscription subscription)
focal_class.identifier: validateSubscription
focal_class.modifiers: private
focal_class.parameters: (Subscription subscription)
focal_class.return: void
focal_class.signature: void validateSubscription(Subscription subscription)
focal_class.class_method_signature: SubscriptionService.validateUpdateSubscription(Subscription current, Subscription updated)
focal_class.full_signature: private void validateUpdateSubscription(Subscription current, Subscription updated)
focal_class.identifier: validateUpdateSubscription
focal_class.modifiers: private
focal_class.parameters: (Subscription current, Subscription updated)
focal_class.return: void
focal_class.signature: void validateUpdateSubscription(Subscription current, Subscription updated)
focal_class.class_method_signature: SubscriptionService.isLastSubscriptionActiveToDisable(Subscription current, Subscription updated, Alarm alarm)
focal_class.full_signature: private boolean isLastSubscriptionActiveToDisable(Subscription current, Subscription updated, Alarm alarm)
focal_class.identifier: isLastSubscriptionActiveToDisable
focal_class.modifiers: private
focal_class.parameters: (Subscription current, Subscription updated, Alarm alarm)
focal_class.return: boolean
focal_class.signature: boolean isLastSubscriptionActiveToDisable(Subscription current, Subscription updated, Alarm alarm)
focal_class.class_method_signature: SubscriptionService.deleteSubscription(String alarmId, String subscriptionId)
focal_class.full_signature: public SubscriptionService.DeletedSubscriptionStatus deleteSubscription(String alarmId, String subscriptionId)
focal_class.identifier: deleteSubscription
focal_class.modifiers: public
focal_class.parameters: (String alarmId, String subscriptionId)
focal_class.return: SubscriptionService.DeletedSubscriptionStatus
focal_class.signature: SubscriptionService.DeletedSubscriptionStatus deleteSubscription(String alarmId, String subscriptionId)
focal_method.body: public SubscriptionService.DeletedSubscriptionStatus deleteSubscription(String alarmId, String subscriptionId) {
          LOGGER.info("Delete subscription {} for alarm {}", subscriptionId, alarmId);
  
          if (this.seyrenRepository.deleteSubscription(alarmId, subscriptionId)) {
              Alarm alarm = seyrenRepository.getAlarm(alarmId);
              if (alarm.getSubscriptions().isEmpty()) {
                  if (seyrenRepository.deleteAlarm(alarmId)) {
                      return SubscriptionService.DeletedSubscriptionStatus.ALARM_DELETED;
                  }
                  throw new CerebroException(ErrorCode.SEYREN_ERROR, "Delete alarm '" + alarmId + "'has fail");
              }
              return SubscriptionService.DeletedSubscriptionStatus.OK;
          }
  
          throw new CerebroException(ErrorCode.SUBSCRIPTION_DELETE_ERROR,
              "Delete subscription '" + subscriptionId + "' on alarm '" + alarmId + "' has fail");
      }
focal_method.class_method_signature: SubscriptionService.deleteSubscription(String alarmId, String subscriptionId)
focal_method.full_signature: public SubscriptionService.DeletedSubscriptionStatus deleteSubscription(String alarmId, String subscriptionId)
focal_method.identifier: deleteSubscription
focal_method.invocations: info deleteSubscription getAlarm isEmpty getSubscriptions deleteAlarm
focal_method.modifiers: public
focal_method.parameters: (String alarmId, String subscriptionId)
focal_method.return: SubscriptionService.DeletedSubscriptionStatus
focal_method.signature: SubscriptionService.DeletedSubscriptionStatus deleteSubscription(String alarmId, String subscriptionId)