### Question:
LabelAnnotations implements FluentLabelProvider { @Override public String getLabel() { return label; } LabelAnnotations(Field field); @Override String getLabel(); @SuppressWarnings("PMD.MethodReturnsInternalArray") @Override String[] getLabelHints();  }### Answer:
@Test public void shouldSetLabelValueFromLabelAnnotation() throws NoSuchFieldException { LabelAnnotations labelAnnotations = createLabelAnnotationsForField("fieldWithLabel"); assertThat(labelAnnotations.getLabel()).isEqualTo("a label value"); }
@Test public void shouldSetLabelFromClassAndFieldNameIfLabelAnnotationValueIsEmpty() throws NoSuchFieldException { LabelAnnotations labelAnnotations = createLabelAnnotationsForField("fieldWithEmptyLabel"); assertThat(labelAnnotations.getLabel()).isEqualTo("DummyClass.fieldWithEmptyLabel"); }
@Test public void shouldNotSetLabelIfLabelAnnotationIsNotPresent() throws NoSuchFieldException { LabelAnnotations labelAnnotations = createLabelAnnotationsForField("fieldWithoutLabel"); assertThat(labelAnnotations.getLabel()).isNull(); }