Skip to content

Commit

Permalink
fixed test
Browse files Browse the repository at this point in the history
  • Loading branch information
paullatzelsperger committed Jun 3, 2022
1 parent b87191e commit f307dff
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;

class AssetServiceImplTest {
Expand Down Expand Up @@ -80,7 +81,7 @@ void createAsset_shouldCreateAssetIfItDoesNotAlreadyExist() {

assertThat(inserted.succeeded()).isTrue();
assertThat(inserted.getContent()).matches(hasId("assetId"));
verify(loader).accept(argThat(it -> "assetId".equals(it.getId())), argThat(it -> "addressType".equals(it.getType())));
verify(loader).accept(argThat(it -> "assetId" .equals(it.getId())), argThat(it -> "addressType" .equals(it.getType())));
}

@Test
Expand Down Expand Up @@ -119,16 +120,18 @@ void delete_shouldNotDeleteIfAssetIsAlreadyPartOfAnAgreement() {
.id(UUID.randomUUID().toString())
.providerAgentId(UUID.randomUUID().toString())
.consumerAgentId(UUID.randomUUID().toString())
.assetId("assetId")
.assetId(asset.getId())
.policyId("policyId")
.build())
.build();
when(contractNegotiationStore.queryNegotiations(any())).thenReturn(Stream.of(contractNegotiation));
when(contractNegotiationStore.getNegotiationsWithAgreementOnAsset(any())).thenReturn(Stream.of(contractNegotiation));

var deleted = service.delete("assetId");

assertThat(deleted.failed()).isTrue();
assertThat(deleted.getFailure().getReason()).isEqualTo(CONFLICT);
verify(contractNegotiationStore).getNegotiationsWithAgreementOnAsset(any());
verifyNoMoreInteractions(contractNegotiationStore);
}

@Test
Expand Down

0 comments on commit f307dff

Please sign in to comment.