public void shouldAddBranch()

in component-test/src/main/java/org/apache/fineract/cn/office/TestOffice.java [111:130]


  public void shouldAddBranch() throws Exception {
    final Office office = OfficeFactory.createRandomOffice();
    this.organizationManager.createOffice(office);
    this.eventRecorder.wait(EventConstants.OPERATION_POST_OFFICE, office.getIdentifier());

    final Office branch = OfficeFactory.createRandomOffice();
    this.organizationManager.addBranch(office.getIdentifier(), branch);
    this.eventRecorder.wait(EventConstants.OPERATION_POST_OFFICE, branch.getIdentifier());

    final OfficePage officePage = this.organizationManager.getBranches(office.getIdentifier(), 0, 10, null, null);
    Assert.assertEquals(Long.valueOf(1L), officePage.getTotalElements());

    final Office savedBranch = officePage.getOffices().get(0);
    Assert.assertEquals(branch.getIdentifier(), savedBranch.getIdentifier());

    this.organizationManager.deleteOffice(branch.getIdentifier());
    this.eventRecorder.wait(EventConstants.OPERATION_DELETE_OFFICE, branch.getIdentifier());
    this.organizationManager.deleteOffice(office.getIdentifier());
    this.eventRecorder.wait(EventConstants.OPERATION_DELETE_OFFICE, office.getIdentifier());
  }