-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christophe '116' Loiseau
committed
Feb 13, 2024
1 parent
78d92b0
commit 61a998a
Showing
7 changed files
with
90 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...alog-parser/src/test/java/de/sovity/edc/utils/catalog/mapper/DspDataOfferBuilderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package de.sovity.edc.utils.catalog.mapper; | ||
|
||
import jakarta.json.Json; | ||
import lombok.val; | ||
import org.eclipse.edc.jsonld.TitaniumJsonLd; | ||
import org.eclipse.edc.spi.monitor.Monitor; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; | ||
import static org.mockito.Mockito.mock; | ||
|
||
class DspDataOfferBuilderTest { | ||
@Test | ||
void testCanConvertTheEdcIdToAStableId() { | ||
// arrange | ||
val contractOffer = Json.createObjectBuilder() | ||
.add("@id", "part1:part2:part3") | ||
.add("somefield", "somevalue") | ||
.build(); | ||
|
||
// act | ||
val monitor = mock(Monitor.class); | ||
val result = new DspDataOfferBuilder(new TitaniumJsonLd(monitor), monitor).buildContractOffer(contractOffer); | ||
|
||
// assert | ||
val stableId = "part1:part2:KbdwJ8MGwX3y7K9mi3lhzplluhc="; | ||
assertThat(result.getContractOfferId()).isEqualTo(stableId); | ||
assertThat(result.getPolicyJsonLd().getString("@id")).isEqualTo(stableId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters