Skip to content

Commit

Permalink
Fix import of Location class
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada committed Feb 2, 2024
1 parent c8684ca commit 64e5d77
Showing 1 changed file with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.List;

import javax.xml.stream.*;
import javax.xml.stream.Location;

import org.itsallcode.matcher.auto.AutoMatcher;
import org.itsallcode.openfasttrace.api.core.*;
Expand All @@ -29,7 +28,7 @@ void testExportImportSimpleSpecObjectWithMandatoryElements()
final SpecificationItem item = SpecificationItem.builder() //
.id(SpecificationItemId.createId("foo", "bar", 1)) //
.description("the description") //
.location(Location.create("dummy.xml", 4)) //
.location(location(4)) //
.build();
assertExportAndImport(item);
}
Expand All @@ -48,7 +47,7 @@ void testExportImportSpecObjectWithOptionalElements() throws IOException, XMLStr
.addDependOnId("req", "depend-on", 1) //
.addNeedsArtifactType("impl") //
.addTag("the tag") //
.location(Location.create("dummy.xml", 4)) //
.location(location(4)) //
.build();
assertExportAndImport(item);
}
Expand All @@ -62,19 +61,24 @@ void testExportImportTwoSpecObjects() throws IOException, XMLStreamException
.description("the description") //
.rationale("the rationale") //
.comment("the comment") //
.location(Location.create("dummy.xml", 4)) //
.location(location(4)) //
.build();
final SpecificationItem itemB = SpecificationItem.builder() //
.id(SpecificationItemId.createId("baz", "zoo", 2)) //
.status(ItemStatus.REJECTED) //
.description("another\ndescription") //
.rationale("another\nrationale") //
.comment("another\ncomment") //
.location(Location.create("dummy.xml", 5)) //
.location(location(5)) //
.build();
assertExportAndImport(itemA, itemB);
}

private org.itsallcode.openfasttrace.api.core.Location location(final int line)
{
return org.itsallcode.openfasttrace.api.core.Location.create("dummy.xml", line);
}

private void assertExportAndImport(final SpecificationItem... items)
{
final String exportedItems = exportToString(items);
Expand Down

0 comments on commit 64e5d77

Please sign in to comment.