@Test
  public void testUpdateLookupParameter() throws Exception {
    protocolFundingSourceService = new ProtocolFundingSourceServiceImpl();
    Entry<String, String> entry =
        protocolFundingSourceService.getLookupParameters(FundingSourceType.SPONSOR);
    Assert.assertNotNull(entry);
    String fieldConversions = entry.getValue();
    StringBuilder builder = new StringBuilder();
    builder.append("sponsorCode:" + PROTOCOL_FUNDING_SOURCE_NUMBER + Constants.COMMA);
    builder.append("sponsorName:" + PROTOCOL_FUNDING_SOURCE_NAME);

    Assert.assertThat(entry.getValue(), JUnitMatchers.containsString(builder.toString()));
    String parameter =
        KRADConstants.METHOD_TO_CALL_BOPARM_LEFT_DEL
            + KRADConstants.METHOD_TO_CALL_BOPARM_RIGHT_DEL
            + KRADConstants.METHOD_TO_CALL_PARM1_LEFT_DEL
            + KRADConstants.METHOD_TO_CALL_PARM1_RIGHT_DEL;
    String updatedParam =
        protocolFundingSourceService.updateLookupParameter(
            parameter, Sponsor.class.getName(), fieldConversions);
    Assert.assertThat(
        updatedParam,
        JUnitMatchers.containsString(
            "(!!" + Sponsor.class.getName() + "!!)(((" + builder.toString() + ")))"));
  }
  @Test
  public void testGetLookupParameters() throws Exception {
    protocolFundingSourceService = new ProtocolFundingSourceServiceImpl();
    StringBuilder builder = new StringBuilder();

    Entry<String, String> entry =
        protocolFundingSourceService.getLookupParameters(FundingSourceType.SPONSOR);
    Assert.assertNotNull(entry);
    builder.append("sponsorCode:" + PROTOCOL_FUNDING_SOURCE_NUMBER + Constants.COMMA);
    builder.append("sponsorName:" + PROTOCOL_FUNDING_SOURCE_NAME);
    Assert.assertThat(entry.getValue(), JUnitMatchers.containsString(builder.toString()));
    builder.delete(0, builder.length());

    entry = protocolFundingSourceService.getLookupParameters(FundingSourceType.UNIT);
    Assert.assertNotNull(entry);
    builder.append("unitNumber:" + PROTOCOL_FUNDING_SOURCE_NUMBER + Constants.COMMA);
    builder.append("unitName:" + PROTOCOL_FUNDING_SOURCE_NAME);
    Assert.assertThat(entry.getValue(), JUnitMatchers.containsString(builder.toString()));
    builder.delete(0, builder.length());

    entry =
        protocolFundingSourceService.getLookupParameters(FundingSourceType.PROPOSAL_DEVELOPMENT);
    Assert.assertNotNull(entry);
    builder.append("proposalNumber:" + PROTOCOL_FUNDING_SOURCE_NUMBER + Constants.COMMA);
    builder.append("sponsor.sponsorName:" + PROTOCOL_FUNDING_SOURCE_NAME + Constants.COMMA);
    builder.append("title:" + PROTOCOL_FUNDING_SOURCE_TITLE);
    Assert.assertThat(entry.getValue(), JUnitMatchers.containsString(builder.toString()));
    builder.delete(0, builder.length());

    entry =
        protocolFundingSourceService.getLookupParameters(FundingSourceType.INSTITUTIONAL_PROPOSAL);
    Assert.assertNotNull(entry);
    builder.append("proposalId:" + PROTOCOL_FUNDING_SOURCE + Constants.COMMA);
    builder.append("proposalNumber:" + PROTOCOL_FUNDING_SOURCE_NUMBER + Constants.COMMA);
    builder.append("sponsor.sponsorName:" + PROTOCOL_FUNDING_SOURCE_NAME + Constants.COMMA);
    builder.append("title:" + PROTOCOL_FUNDING_SOURCE_TITLE);
    Assert.assertThat(entry.getValue(), JUnitMatchers.containsString(builder.toString()));
    builder.delete(0, builder.length());

    entry = protocolFundingSourceService.getLookupParameters(FundingSourceType.AWARD);
    Assert.assertNotNull(entry);
    builder.append("awardId:" + PROTOCOL_FUNDING_SOURCE + Constants.COMMA);
    builder.append("awardNumber:" + PROTOCOL_FUNDING_SOURCE_NUMBER + Constants.COMMA);
    builder.append("sponsor.sponsorName:" + PROTOCOL_FUNDING_SOURCE_NAME + Constants.COMMA);
    builder.append("title:" + PROTOCOL_FUNDING_SOURCE_TITLE);
    Assert.assertThat(entry.getValue(), JUnitMatchers.containsString(builder.toString()));

    try {
      entry = protocolFundingSourceService.getLookupParameters(FundingSourceType.OTHER);
      fail("IllegalArgumentException was not thrown for invalid test case using OTHER");
    } catch (IllegalArgumentException e) {
      // yup
    }
  }