@@ -1951,5 +1951,33 @@ public void testConvertToLicenseExpression() throws InvalidSPDXAnalysisException
19511951 assertTrue (expected .isEmpty ());
19521952 assertEquals (ands .toString (), result .getLicenseExpression ());
19531953 }
1954+
1955+ @ Test
1956+ public void testPackageSupplierNoAssertionAndNone () throws InvalidSPDXAnalysisException {
1957+ // Test that when stringToAgent is called with "NOASSERTION" or "NONE", it should return null
1958+ // rather than creating an Agent with name="NOASSERTION" or "NONE"
1959+
1960+ // Create a CreationInfo with proper idPrefix for testing
1961+ CreationInfo testCreationInfo = Spdx2to3Converter .convertCreationInfo (
1962+ new SpdxCreatorInformation (fromModelStore , DOCUMENT_URI ,
1963+ fromModelStore .getNextId (IdType .Anonymous ), copyManager , true )
1964+ .setCreated ("2010-01-29T18:30:22Z" ),
1965+ toModelStore , DEFAULT_PREFIX );
1966+
1967+ // Test with "NOASSERTION"
1968+ Agent resultNoAssertion = Spdx2to3Converter .stringToAgent ("NOASSERTION" , testCreationInfo );
1969+ assertNull ("stringToAgent should return null for NOASSERTION value" , resultNoAssertion );
1970+
1971+ // Test with "NONE"
1972+ Agent resultNone = Spdx2to3Converter .stringToAgent ("NONE" , testCreationInfo );
1973+ assertNull ("stringToAgent should return null for NONE value" , resultNone );
1974+
1975+ // Test with a valid Person format - should not return null
1976+ String personCreator =
SpdxConstantsCompatV2 .
CREATOR_PREFIX_PERSON +
"John Doe ([email protected] )" ;
1977+ Agent resultPerson = Spdx2to3Converter .stringToAgent (personCreator , testCreationInfo );
1978+ assertNotNull ("stringToAgent should return an Agent for valid Person format" , resultPerson );
1979+ assertTrue ("Result should be a Person" , resultPerson instanceof Person );
1980+ assertEquals ("John Doe" , resultPerson .getName ().get ());
1981+ }
19541982
19551983}
0 commit comments