@Test
  public void testUpdateFundWithEmptyParams() {
    FundsHelper fh =
        FundsHelper.create(Utils.randomNameGenerator("", 10))
            .externalId(Utils.randomNameGenerator("fund-", 5))
            .build();
    String jsonData = fh.toJSON();

    final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
    Assert.assertNotNull(fundID);

    FundsHelper fh2 =
        FundsResourceHandler.updateFund(
            fundID, null, null, this.requestSpec, this.statusOkResponseSpec);

    Assert.assertNull(fh2.getName());
    Assert.assertNull(fh2.getExternalId());

    // assert that there was no change in
    // the name and external ID of the fund
    jsonData =
        FundsResourceHandler.retrieveFund(fundID, this.requestSpec, this.statusOkResponseSpec);
    FundsHelper fh3 = new Gson().fromJson(jsonData, FundsHelper.class);

    Assert.assertEquals(fh.getName(), fh3.getName());
    Assert.assertEquals(fh.getExternalId(), fh3.getExternalId());
  }
  @Test
  public void testRetrieveFund() {
    FundsHelper fh =
        FundsHelper.create(Utils.randomNameGenerator("", 10))
            .externalId(Utils.randomNameGenerator("fund-", 5))
            .build();
    String jsonData = fh.toJSON();

    final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
    Assert.assertNotNull(fundID);

    jsonData =
        FundsResourceHandler.retrieveFund(fundID, this.requestSpec, this.statusOkResponseSpec);
    FundsHelper fh2 = FundsHelper.fromJSON(jsonData);

    assertEquals(fh.getName(), fh2.getName());
  }
  @Test
  public void testUpdateFundWithNewName() {
    FundsHelper fh =
        FundsHelper.create(Utils.randomNameGenerator("", 10))
            .externalId(Utils.randomNameGenerator("fund-", 5))
            .build();
    String jsonData = fh.toJSON();

    final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
    Assert.assertNotNull(fundID);

    String newName = Utils.randomNameGenerator("", 10);
    FundsHelper fh2 =
        FundsResourceHandler.updateFund(
            fundID, newName, null, this.requestSpec, this.statusOkResponseSpec);

    Assert.assertEquals(newName, fh2.getName());
  }
  @Test
  public void testCreateFundWithDuplicateName() {
    FundsHelper fh =
        FundsHelper.create(Utils.randomNameGenerator("", 10))
            .externalId(Utils.randomNameGenerator("fund-", 5))
            .build();
    String jsonData = fh.toJSON();

    final Long fundID = createFund(jsonData, this.requestSpec, this.statusOkResponseSpec);
    Assert.assertNotNull(fundID);

    FundsHelper fh2 =
        FundsHelper.create(fh.getName()).externalId(Utils.randomNameGenerator("fund-", 5)).build();
    jsonData = fh2.toJSON();

    ResponseSpecification responseSpec = new ResponseSpecBuilder().expectStatusCode(403).build();
    final Long fundID2 = createFund(jsonData, this.requestSpec, responseSpec);
    Assert.assertNull(fundID2);
  }