Search in sources :

Example 1 with Operation

use of com.scalar.db.api.Operation in project scalardb by scalar-labs.

the class DeleteStatementHandlerTest method checkArgument_WrongOperationGiven_ShouldThrowIllegalArgumentException.

/**
 * Unit testing for handle() method is covered in InsertStatementHandlerTest
 */
@Test
public void checkArgument_WrongOperationGiven_ShouldThrowIllegalArgumentException() {
    // Arrange
    Operation operation = mock(Put.class);
    // Act Assert
    assertThatThrownBy(() -> StatementHandler.checkArgument(operation, Delete.class)).isInstanceOf(IllegalArgumentException.class);
}
Also used : Operation(com.scalar.db.api.Operation) Test(org.junit.jupiter.api.Test)

Example 2 with Operation

use of com.scalar.db.api.Operation in project scalardb by scalar-labs.

the class InsertStatementHandlerTest method checkArgument_WrongOperationGiven_ShouldThrowIllegalArgumentException.

@Test
public void checkArgument_WrongOperationGiven_ShouldThrowIllegalArgumentException() {
    // Arrange
    Operation operation = mock(Get.class);
    // Act Assert
    assertThatThrownBy(() -> StatementHandler.checkArgument(operation, Put.class)).isInstanceOf(IllegalArgumentException.class);
}
Also used : Operation(com.scalar.db.api.Operation) Test(org.junit.jupiter.api.Test)

Example 3 with Operation

use of com.scalar.db.api.Operation in project scalardb by scalar-labs.

the class SelectStatementHandlerTest method checkArgument_WrongOperationGiven_ShouldThrowIllegalArgumentException.

@Test
public void checkArgument_WrongOperationGiven_ShouldThrowIllegalArgumentException() {
    // Arrange
    Operation operation = mock(Put.class);
    // Act Assert
    assertThatThrownBy(() -> StatementHandler.checkArgument(operation, Get.class, Scan.class)).isInstanceOf(IllegalArgumentException.class);
}
Also used : Operation(com.scalar.db.api.Operation) Test(org.junit.jupiter.api.Test)

Example 4 with Operation

use of com.scalar.db.api.Operation in project scalardb by scalar-labs.

the class CosmosOperationTest method checkArgument_WrongOperationGiven_ShouldThrowIllegalArgumentException.

@Test
public void checkArgument_WrongOperationGiven_ShouldThrowIllegalArgumentException() {
    // Arrange
    Operation operation = mock(Put.class);
    CosmosOperation cosmosOperation = new CosmosOperation(operation, metadata);
    // Act Assert
    assertThatThrownBy(() -> cosmosOperation.checkArgument(Get.class)).isInstanceOf(IllegalArgumentException.class);
}
Also used : Operation(com.scalar.db.api.Operation) Test(org.junit.jupiter.api.Test)

Aggregations

Operation (com.scalar.db.api.Operation)4 Test (org.junit.jupiter.api.Test)4