use of com.buschmais.jqassistant.core.report.model.TestDescriptorWithLanguageElement in project jqa-core-framework by buschmais.
the class LanguageHelperTest method resolveName.
private void resolveName(TestDescriptorWithLanguageElement testDescriptor, LanguageElement expectedLanguageElement) {
when(testDescriptor.getValue()).thenReturn("value");
LanguageElement languageElement = LanguageHelper.getLanguageElement(testDescriptor);
assertThat(languageElement, notNullValue());
assertThat(languageElement, is(expectedLanguageElement));
SourceProvider<TestDescriptorWithLanguageElement> sourceProvider = languageElement.getSourceProvider();
String name = sourceProvider.getName(testDescriptor);
assertThat(name, equalTo("value"));
}
use of com.buschmais.jqassistant.core.report.model.TestDescriptorWithLanguageElement in project jqa-core-framework by buschmais.
the class LanguageHelperTest method resolveNameFromDescriptorWithLanguageElement.
@Test
public void resolveNameFromDescriptorWithLanguageElement() {
TestDescriptorWithLanguageElement testDescriptor = Mockito.mock(TestDescriptorWithLanguageElement.class);
resolveName(testDescriptor, TestLanguageElement.TestElement);
}
use of com.buschmais.jqassistant.core.report.model.TestDescriptorWithLanguageElement in project jqa-core-framework by buschmais.
the class ReportHelperTest method label.
@Test
void label() {
TestDescriptorWithLanguageElement descriptorWithLabel = mock(TestDescriptorWithLanguageElement.class);
when(descriptorWithLabel.getValue()).thenReturn("value");
assertThat(ReportHelper.getLabel(descriptorWithLabel), equalTo("value"));
assertThat(ReportHelper.getLabel(singletonList(descriptorWithLabel)), equalTo("value"));
assertThat(ReportHelper.getLabel(new String[] { "value1", "value2" }), equalTo("value1, value2"));
Map<String, Object> singleProperty = new HashMap<>();
singleProperty.put("key", "Value");
assertThat(ReportHelper.getLabel(singleProperty), equalTo("Value"));
Map<String, Object> multipleProperties = new HashMap<>();
multipleProperties.put("key1", descriptorWithLabel);
multipleProperties.put("key2", "simpleValue");
assertThat(ReportHelper.getLabel(multipleProperties), equalTo("key1:value, key2:simpleValue"));
TestDescriptorWithLanguageElement descriptorWithEmptyLanguageLabel = mock(TestDescriptorWithLanguageElement.class);
assertThat(ReportHelper.getLabel(descriptorWithEmptyLanguageLabel), notNullValue());
// Composite object without supported label
Neo4jNode neo4jNode = mock(Neo4jNode.class);
doReturn(multipleProperties).when(neo4jNode).getProperties();
CompositeObject compositeObject = mock(CompositeObject.class);
doReturn(neo4jNode).when(compositeObject).getDelegate();
assertThat(ReportHelper.getLabel(compositeObject), equalTo("key1:value, key2:simpleValue"));
}
use of com.buschmais.jqassistant.core.report.model.TestDescriptorWithLanguageElement in project jqa-core-framework by buschmais.
the class XmlReportTestHelper method createRow.
private static Map<String, Object> createRow() {
Map<String, Object> row = new HashMap<>();
row.put(C1, "simpleValue");
row.put(C2, new TestDescriptorWithLanguageElement() {
@Override
public <I> I getId() {
return null;
}
@Override
public <T> T as(Class<T> type) {
return null;
}
@Override
public <D> D getDelegate() {
return null;
}
@Override
public String getValue() {
return "descriptorValue";
}
});
return row;
}
Aggregations