Skip to content

How to mock ResourceResponse<Document> #132

@shubhamsxn65

Description

@shubhamsxn65

There are no constructors provided for mocking ResourceResponse purpose? Is this a feature planned? Are there any alternatives as of now?

On running the below code.

@Test
  def createDatabaseTest(): Unit = {
    var database : Database = new Database()
    database.setId("randomName")
    when(documentClient.createDatabase(any(classOf[Database]), any(classOf[RequestOptions]))).thenReturn(new ResourceResponse[Database](database))
    
    cosmosDbClient.createDatabase("randomName", null)
  }

I am getting this exception:

Error:(34, 106) constructor ResourceResponse in class ResourceResponse cannot be accessed in class CosmosDbClientTest
    when(documentClient.createDatabase(any(classOf[Database]), any(classOf[RequestOptions]))).thenReturn(new ResourceResponse[Database](database))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions