コード例 #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"));
  }
コード例 #2
0
  @Before
  public void setUp() {

    ArrayList<String> desc = new ArrayList<String>();
    desc.add("testDesc1");
    Mockito.when(mockedFeature1.getDistinctDescription()).thenReturn(desc);
    Mockito.when(mockedFeature1.getLabel()).thenReturn("Feature1");
    Mockito.when(mockedFeature1.getFeatureStem()).thenReturn("FeatureStem1");
    mockedFeature2.setLabel("Feature2");

    options = Mockito.mock(OptionTransferObject.class);

    featureContainer = new FeatureContainer();
    featureContainer.setOptions(options);
  }
コード例 #3
0
 public void testLabel() throws CoreException, MalformedURLException {
   String label = "dummy label";
   Feature feature = getFeature();
   feature.setLabel(label);
   assertEquals(label, feature.getLabel());
 }