/*
   * To verify that NMS is not able to change the location of
   * beneficiary using MCTS ID when location information is wrong.
   *
   * https://applab.atlassian.net/browse/NMS-231
   */
  @Test
  public void verifyFT325() throws Exception {
    createLocationData();

    Long msisdn = subscriptionHelper.makeNumber();
    String childId = "0123456789";

    MctsChild child = new MctsChild(childId);
    child.setState(stateDataService.findByCode(21L));
    child.setDistrict(districtService.findByStateAndCode(child.getState(), 2L));
    makeMctsSubscription(child, DateTime.now().minusDays(100), SubscriptionPackType.CHILD, msisdn);

    // district provided in request doesn't exist in nms-db
    Reader reader = createUpdateReaderWithHeaders("1," + childId + ",,,,21,8,0026,453,,,,,,");
    mctsBeneficiaryUpdateService.updateBeneficiaryData(reader);

    Subscriber subscriber = subscriberDataService.findByCallingNumber(msisdn);
    assertNotNull(subscriber);
    assertNotEquals(subscriber.getChild().getDistrict().getCode(), new Long(7));

    List<SubscriptionError> susbErrors = subscriptionErrorDataService.findByBeneficiaryId(childId);
    SubscriptionError susbError = susbErrors.iterator().next();
    assertNotNull(susbError);
    assertEquals(SubscriptionRejectionReason.INVALID_LOCATION, susbError.getRejectionReason());
  }