コード例 #1
0
  @Test
  public void testGetDistinctLabels() {

    FeatureOccurrence mockedOccurrence1 = new FeatureOccurrence();
    FeatureOccurrence mockedOccurrence2 = new FeatureOccurrence();
    FeatureOccurrence mockedOccurrence3 = new FeatureOccurrence();

    mockedOccurrence1.setOccurrenceName("occurrence1");
    mockedOccurrence2.setOccurrenceName("occurrence2");
    mockedOccurrence3.setOccurrenceName("firstOccurrence");

    Feature feature = new Feature();
    feature.setLabel("firstOccurrence");

    feature.addFeatureOccurrence(mockedOccurrence1);
    feature.addFeatureOccurrence(mockedOccurrence2);
    feature.addFeatureOccurrence(mockedOccurrence3);

    featureContainer.getFeatureDictionary().put("firstOccurrence", feature);

    ArrayList<String> expected = new ArrayList<String>();
    expected.add("occurrence1");
    expected.add("occurrence2");

    Assert.assertEquals(expected, featureContainer.getDistinctLabels("firstOccurrence"));
  }