From ac78ce87f67f3dbf9e3af064799f6db77288dc77 Mon Sep 17 00:00:00 2001 From: Tudor Voicu Date: Tue, 19 Oct 2021 09:08:38 +0200 Subject: [PATCH] Deleted ApiTransactionServiceSpec --- .../ApiTransactionServiceSpec.scala | 76 ------------------- 1 file changed, 76 deletions(-) delete mode 100644 ledger/participant-integration-api/src/test/suite/scala/platform/apiserver/services/transaction/ApiTransactionServiceSpec.scala diff --git a/ledger/participant-integration-api/src/test/suite/scala/platform/apiserver/services/transaction/ApiTransactionServiceSpec.scala b/ledger/participant-integration-api/src/test/suite/scala/platform/apiserver/services/transaction/ApiTransactionServiceSpec.scala deleted file mode 100644 index 8a0718abcdbd..000000000000 --- a/ledger/participant-integration-api/src/test/suite/scala/platform/apiserver/services/transaction/ApiTransactionServiceSpec.scala +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. -// SPDX-License-Identifier: Apache-2.0 - -package com.daml.platform.apiserver.services.transaction - -import com.codahale.metrics.MetricRegistry -import com.daml.ledger.api.DomainMocks -import com.daml.ledger.participant.state.index.v2.IndexTransactionsService -import com.daml.logging.LoggingContext -import com.daml.metrics.Metrics -import com.daml.platform.apiserver.ErrorCodesVersionSwitcher -import io.grpc.StatusRuntimeException -import org.mockito.MockitoSugar -import org.scalatest.Assertion -import org.scalatest.flatspec.AsyncFlatSpec -import org.scalatest.matchers.should.Matchers - -import scala.concurrent.Future - -class ApiTransactionServiceSpec extends AsyncFlatSpec with Matchers with MockitoSugar { - - it should "return correct exception when transaction is not found (V1)" in { - testLookUpFlatByTransactionId( - enableSelfServiceErrorCodes = false, - expectedErrorMessage = "NOT_FOUND: Transaction not found, or not visible.", - ) - } - - it should "return correct exception when transaction is not found (V2)" in { - testLookUpFlatByTransactionId( - enableSelfServiceErrorCodes = true, - expectedErrorMessage = - "NOT_FOUND: TRANSACTION_NOT_FOUND(11,0): Transaction not found, or not visible.", - ) - } - - private def testLookUpFlatByTransactionId( - enableSelfServiceErrorCodes: Boolean, - expectedErrorMessage: String, - ): Future[Assertion] = { - // given - val transactionsServiceMock = mock[IndexTransactionsService] - val setOfParties = Set(DomainMocks.party) - when( - transactionsServiceMock.getTransactionById( - DomainMocks.transactionId, - setOfParties, - )(LoggingContext.ForTesting) - ).thenReturn( - Future.successful(None) - ) - - val tested = new ApiTransactionService( - transactionsService = transactionsServiceMock, - metrics = new Metrics(new MetricRegistry), - errorsVersionsSwitcher = - new ErrorCodesVersionSwitcher(enableSelfServiceErrorCodes = enableSelfServiceErrorCodes), - )( - executionContext = executionContext, - loggingContext = LoggingContext.ForTesting, - ) - - // when - val actual = recoverToExceptionIf[StatusRuntimeException] { - tested.lookUpFlatByTransactionId( - transactionId = DomainMocks.transactionId, - requestingParties = setOfParties, - ) - } - - // then - actual.map { ex => - assert(ex.getMessage == expectedErrorMessage) - } - } -}