Skip to content

Commit

Permalink
Fix Issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-zepol committed Sep 7, 2024
1 parent dde0024 commit 8e83322
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class Occurrence extends ExtensibleElement
private Integer offset;

@VersionFilter(Version.VERSION_16)
private Integer symbol;
private String symbol;

@VersionFilter(Version.VERSION_16)
private String additionalContext;
Expand Down Expand Up @@ -67,11 +67,11 @@ public void setOffset(final Integer offset) {
this.offset = offset;
}

public Integer getSymbol() {
public String getSymbol() {
return symbol;
}

public void setSymbol(final Integer symbol) {
public void setSymbol(final String symbol) {
this.symbol = symbol;
}

Expand Down
10 changes: 7 additions & 3 deletions src/test/java/org/cyclonedx/parsers/AbstractParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -680,9 +680,9 @@ private void assertEvidence(final Evidence evidence, final Version version) {
assertEquals("http://www.apache.org/licenses/LICENSE-2.0",
evidence.getLicenseChoice().getLicenses().get(0).getUrl());

if (version == Version.VERSION_15) {
if (version.getVersion() >= Version.VERSION_15.getVersion()) {
assertCallStack(evidence.getCallstack());
assertOccurrences(evidence.getOccurrences());
assertOccurrences(evidence.getOccurrences(), version);
assertEquals(1, evidence.getIdentities().size());
assertIdentifiers(evidence.getIdentities().get(0), version);
}
Expand All @@ -693,12 +693,16 @@ private void assertEvidence(final Evidence evidence, final Version version) {
}
}

private void assertOccurrences(final List<Occurrence> occurrences){
private void assertOccurrences(final List<Occurrence> occurrences, Version version){
assertEquals(occurrences.size(), 1);
Occurrence occurrence = occurrences.get(0);

assertNotNull(occurrence.getBomRef());
assertNotNull(occurrence.getLocation());

if (version.getVersion() >= Version.VERSION_16.getVersion()) {
assertNotNull(occurrence.getSymbol());
}
}

private void assertCallStack(final Callstack callstack){
Expand Down
3 changes: 2 additions & 1 deletion src/test/resources/1.6/valid-evidence-1.6.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"occurrences": [
{
"bom-ref": "d6bf237e-4e11-4713-9f62-56d18d5e2079",
"location": "/path/to/component"
"location": "/path/to/component",
"symbol": "test"
},
{
"bom-ref": "b574d5d1-e3cf-4dcd-9ba5-f3507eb1b175",
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/1.6/valid-evidence-1.6.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<occurrences>
<occurrence bom-ref="d6bf237e-4e11-4713-9f62-56d18d5e2079">
<location>/path/to/component</location>
<symbol>test</symbol>
</occurrence>
<occurrence bom-ref="b574d5d1-e3cf-4dcd-9ba5-f3507eb1b175">
<location>/another/path/to/component</location>
Expand Down

0 comments on commit 8e83322

Please sign in to comment.