/** * This method gets the list of Sponsor Term Types from the database. * * @param */ protected List<KeyValue> getSponsorTermTypesFromDatabase() { PersistableBusinessObjectValuesFinder persistableBusinessObjectValuesFinder = new PersistableBusinessObjectValuesFinder(); persistableBusinessObjectValuesFinder.setBusinessObjectClass(SponsorTermType.class); persistableBusinessObjectValuesFinder.setKeyAttributeName(SPONSOR_TERM_TYPE_CODE); persistableBusinessObjectValuesFinder.setLabelAttributeName(DESCRIPTION); return persistableBusinessObjectValuesFinder.getKeyValues(); }
@Test public void testGetKeyValues() throws Exception { PersistableBusinessObjectValuesFinder persistableBusinessObjectValuesFinder = (PersistableBusinessObjectValuesFinder) getValuesFinderClass().newInstance(); persistableBusinessObjectValuesFinder.setBusinessObjectClass(getBusinessObjectClass()); persistableBusinessObjectValuesFinder.setIncludeKeyInDescription(isIncludeKeyInDescription()); persistableBusinessObjectValuesFinder.setKeyAttributeName(getKeyAttributeName()); persistableBusinessObjectValuesFinder.setLabelAttributeName(getLabelAttributeName()); persistableBusinessObjectValuesFinder.getKeyValues(); assertEquals( "expected:\n" + testKeyValues + "\nactual:\n" + persistableBusinessObjectValuesFinder.getKeyValues(), testKeyValues.size(), persistableBusinessObjectValuesFinder.getKeyValues().size()); for (int i = 0; i < testKeyValues.size(); i++) { assertEquals( testKeyValues.get(i).getValue(), persistableBusinessObjectValuesFinder.getKeyLabel( testKeyValues.get(i).getKey().toString())); } }