/**
   * Test method for {@link
   * com.sinet.gage.provision.service.DistrictService#insertDistrict(District)}
   */
  @Test
  public void testInsertDistrict() {
    District district = createDistrict(1L);
    when(mockDistrictRepository.save(any(District.class))).thenReturn(district);

    District result = mockDistrictService.insertDistrict(district);

    assertNotNull(result.getDomainId());
    verify(mockDistrictRepository, times(1)).save(any(District.class));
  }
  /**
   * Test method for {@link com.sinet.gage.provision.service.DistrictService#deleteDistrict(Long)}
   */
  @Test
  public void testUpdateDistrictNotExisting() {
    District district = createDistrict(1L);
    when(mockDistrictRepository.findOne(anyLong())).thenReturn(null);
    when(mockDistrictRepository.save(any(District.class))).thenReturn(district);

    District result = mockDistrictService.updateDistrict(district);

    assertEquals(ADMIN_FIRST_NAME, result.getAdministrator().getFirstName());
    verify(mockDistrictRepository, times(1)).findOne(anyLong());
    verify(mockDistrictRepository, times(1)).save(any(District.class));
  }
 private District createDistrict(Long domainId) {
   District district = new District();
   district.setDomainId(domainId);
   district.setName("District Of Tempe");
   district.setUserSpace("dot-12345");
   district.setAdminUser("Mark Schaufer");
   district.setAdministrator(createAdministrator());
   return district;
 }