Issue 1179: Implement PyPi package distribution metadata validation
Add null and empty test cases for version field
@@ -7,6 +7,7 @@ import org.carlspring.strongbox.domain.PypiPackageInfo;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.NullAndEmptySource;
import org.junit.jupiter.params.provider.ValueSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -213,6 +214,14 @@ public class PypiMetadataParserTest
.isThrownBy(() -> validate(prepareKeyValueMap(version)));
}
+ @ParameterizedTest
+ @NullAndEmptySource
+ public void testNullAndEmptyVersion(String version)
+ {
+ assertThatExceptionOfType(ConstraintViolationException.class)
+ .isThrownBy(() -> validate(prepareKeyValueMap(version)));
+ }
+
private Map<String, String> prepareKeyValueMap(String version)
{
Map<String, String> keyValueMap = new HashMap<>();
