use of com.synopsys.integration.detect.workflow.blackduck.project.customfields.CustomFieldDocument in project synopsys-detect by blackducksoftware.
the class DetectCustomFieldParserTest method parsedVersionMultiple.
@Test
public void parsedVersionMultiple() throws DetectUserFriendlyException {
Map<String, String> props = new HashMap<>();
props.put("detect.custom.fields.version[0].label", "label");
props.put("detect.custom.fields.version[0].value", "value1");
props.put("detect.custom.fields.version[1].label", "label");
props.put("detect.custom.fields.version[1].value", "value1");
props.put("detect.custom.fields.version[2].label", "label");
props.put("detect.custom.fields.version[2].value", "value1");
DetectCustomFieldParser parser = new DetectCustomFieldParser();
CustomFieldDocument document = parser.parseCustomFieldDocument(props);
Assertions.assertEquals(3, document.getVersion().size());
}
use of com.synopsys.integration.detect.workflow.blackduck.project.customfields.CustomFieldDocument in project synopsys-detect by blackducksoftware.
the class DetectCustomFieldParserTest method parsedEmptySingleQuotesAsEmptyArray.
@Test
public void parsedEmptySingleQuotesAsEmptyArray() throws DetectUserFriendlyException {
Map<String, String> props = new HashMap<>();
props.put("detect.custom.fields.project[0].name", "example");
props.put("detect.custom.fields.project[0].value", "''");
DetectCustomFieldParser parser = new DetectCustomFieldParser();
CustomFieldDocument document = parser.parseCustomFieldDocument(props);
CustomFieldElement element = document.getProject().get(0);
Assertions.assertEquals(0, element.getValue().size());
}
use of com.synopsys.integration.detect.workflow.blackduck.project.customfields.CustomFieldDocument in project synopsys-detect by blackducksoftware.
the class DetectCustomFieldParserTest method parsedEmptyStringAsEmptyArray.
@Test
public void parsedEmptyStringAsEmptyArray() throws DetectUserFriendlyException {
Map<String, String> props = new HashMap<>();
props.put("detect.custom.fields.project[0].name", "example");
props.put("detect.custom.fields.project[0].value", "");
DetectCustomFieldParser parser = new DetectCustomFieldParser();
CustomFieldDocument document = parser.parseCustomFieldDocument(props);
CustomFieldElement element = document.getProject().get(0);
Assertions.assertEquals(0, element.getValue().size());
}
use of com.synopsys.integration.detect.workflow.blackduck.project.customfields.CustomFieldDocument in project synopsys-detect by blackducksoftware.
the class DetectCustomFieldParserTest method parsedEmptyQuotesAsEmptyArray.
@Test
public void parsedEmptyQuotesAsEmptyArray() throws DetectUserFriendlyException {
Map<String, String> props = new HashMap<>();
props.put("detect.custom.fields.project[0].name", "example");
props.put("detect.custom.fields.project[0].value", "\"\"");
DetectCustomFieldParser parser = new DetectCustomFieldParser();
CustomFieldDocument document = parser.parseCustomFieldDocument(props);
CustomFieldElement element = document.getProject().get(0);
Assertions.assertEquals(0, element.getValue().size());
}
use of com.synopsys.integration.detect.workflow.blackduck.project.customfields.CustomFieldDocument in project synopsys-detect by blackducksoftware.
the class DetectCustomFieldParserTest method parsedVersion.
@Test
public void parsedVersion() throws DetectUserFriendlyException {
Map<String, String> props = new HashMap<>();
props.put("detect.custom.fields.version[0].label", "label");
props.put("detect.custom.fields.version[0].value", "value1, value2");
DetectCustomFieldParser parser = new DetectCustomFieldParser();
CustomFieldDocument document = parser.parseCustomFieldDocument(props);
Assertions.assertEquals(1, document.getVersion().size());
CustomFieldElement element = document.getVersion().get(0);
Assertions.assertEquals("label", element.getLabel());
Assertions.assertEquals(2, element.getValue().size());
Assertions.assertTrue(element.getValue().contains("value1"));
Assertions.assertTrue(element.getValue().contains("value2"));
}
Aggregations