Search in sources :

Example 1 with Projection

use of software.amazon.awssdk.services.dynamodb.model.Projection in project para by Erudika.

the class AWSDynamoUtils method createSharedTable.

/**
 * Creates a table in AWS DynamoDB which will be shared between apps.
 * @param readCapacity read capacity
 * @param writeCapacity write capacity
 * @return true if created
 */
public static boolean createSharedTable(long readCapacity, long writeCapacity) {
    if (StringUtils.isBlank(SHARED_TABLE) || StringUtils.containsWhitespace(SHARED_TABLE) || existsTable(SHARED_TABLE)) {
        return false;
    }
    String table = getTableNameForAppid(SHARED_TABLE);
    try {
        GlobalSecondaryIndex secIndex = GlobalSecondaryIndex.builder().indexName(getSharedIndexName()).provisionedThroughput(b -> b.readCapacityUnits(1L).writeCapacityUnits(1L)).projection(Projection.builder().projectionType(ProjectionType.ALL).build()).keySchema(KeySchemaElement.builder().attributeName(Config._APPID).keyType(KeyType.HASH).build(), KeySchemaElement.builder().attributeName(Config._ID).keyType(KeyType.RANGE).build()).build();
        AttributeDefinition[] attributes = new AttributeDefinition[] { AttributeDefinition.builder().attributeName(Config._KEY).attributeType(ScalarAttributeType.S).build(), AttributeDefinition.builder().attributeName(Config._APPID).attributeType(ScalarAttributeType.S).build(), AttributeDefinition.builder().attributeName(Config._ID).attributeType(ScalarAttributeType.S).build() };
        CreateTableResponse tbl = getClient().createTable(b -> b.tableName(table).keySchema(KeySchemaElement.builder().attributeName(Config._KEY).keyType(KeyType.HASH).build()).sseSpecification(b2 -> b2.enabled(ENCRYPTION_AT_REST_ENABLED)).attributeDefinitions(attributes).globalSecondaryIndexes(secIndex).provisionedThroughput(b6 -> b6.readCapacityUnits(readCapacity).writeCapacityUnits(writeCapacity)));
        logger.info("Waiting for DynamoDB table to become ACTIVE...");
        waitForActive(table, AWS_REGION);
        logger.info("Created shared table '{}', status {}.", table, tbl.tableDescription().tableStatus());
        if (BACKUPS_ENABLED) {
            logger.info("Enabling backups for shared table '{}'...", table);
            getClient().updateContinuousBackups((t) -> t.tableName(table).pointInTimeRecoverySpecification((p) -> p.pointInTimeRecoveryEnabled(true)));
        }
    } catch (Exception e) {
        logger.error(null, e);
        return false;
    }
    return true;
}
Also used : TableDescription(software.amazon.awssdk.services.dynamodb.model.TableDescription) KeysAndAttributes(software.amazon.awssdk.services.dynamodb.model.KeysAndAttributes) LoggerFactory(org.slf4j.LoggerFactory) DynamoDbAsyncClient(software.amazon.awssdk.services.dynamodb.DynamoDbAsyncClient) StringUtils(org.apache.commons.lang3.StringUtils) StreamViewType(software.amazon.awssdk.services.dynamodb.model.StreamViewType) Map(java.util.Map) GlobalSecondaryIndex(software.amazon.awssdk.services.dynamodb.model.GlobalSecondaryIndex) URI(java.net.URI) WaiterResponse(software.amazon.awssdk.core.waiters.WaiterResponse) Config(com.erudika.para.core.utils.Config) ScalarAttributeType(software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType) DynamoDbClient(software.amazon.awssdk.services.dynamodb.DynamoDbClient) ParaObject(com.erudika.para.core.ParaObject) ProjectionType(software.amazon.awssdk.services.dynamodb.model.ProjectionType) ScanResponse(software.amazon.awssdk.services.dynamodb.model.ScanResponse) KeyType(software.amazon.awssdk.services.dynamodb.model.KeyType) QueryResponse(software.amazon.awssdk.services.dynamodb.model.QueryResponse) ReturnConsumedCapacity(software.amazon.awssdk.services.dynamodb.model.ReturnConsumedCapacity) Collectors(java.util.stream.Collectors) List(java.util.List) BatchGetItemResponse(software.amazon.awssdk.services.dynamodb.model.BatchGetItemResponse) Annotation(java.lang.annotation.Annotation) AttributeValue(software.amazon.awssdk.services.dynamodb.model.AttributeValue) Optional(java.util.Optional) Para(com.erudika.para.core.utils.Para) DefaultAwsRegionProviderChain(software.amazon.awssdk.regions.providers.DefaultAwsRegionProviderChain) ListTablesResponse(software.amazon.awssdk.services.dynamodb.model.ListTablesResponse) App(com.erudika.para.core.App) QueryRequest(software.amazon.awssdk.services.dynamodb.model.QueryRequest) Replica(software.amazon.awssdk.services.dynamodb.model.Replica) DescribeTableResponse(software.amazon.awssdk.services.dynamodb.model.DescribeTableResponse) ParaObjectUtils(com.erudika.para.core.utils.ParaObjectUtils) HashMap(java.util.HashMap) Pager(com.erudika.para.core.utils.Pager) StaticCredentialsProvider(software.amazon.awssdk.auth.credentials.StaticCredentialsProvider) ServiceNamespace(software.amazon.awssdk.services.applicationautoscaling.model.ServiceNamespace) ProvisionedThroughputExceededException(software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughputExceededException) MetricType(software.amazon.awssdk.services.applicationautoscaling.model.MetricType) ScalableDimension(software.amazon.awssdk.services.applicationautoscaling.model.ScalableDimension) CreateTableRequest(software.amazon.awssdk.services.dynamodb.model.CreateTableRequest) ScanRequest(software.amazon.awssdk.services.dynamodb.model.ScanRequest) ApplicationAutoScalingClient(software.amazon.awssdk.services.applicationautoscaling.ApplicationAutoScalingClient) WriteRequest(software.amazon.awssdk.services.dynamodb.model.WriteRequest) LinkedList(java.util.LinkedList) Region(software.amazon.awssdk.regions.Region) GlobalSecondaryIndexDescription(software.amazon.awssdk.services.dynamodb.model.GlobalSecondaryIndexDescription) Logger(org.slf4j.Logger) AttributeDefinition(software.amazon.awssdk.services.dynamodb.model.AttributeDefinition) PolicyType(software.amazon.awssdk.services.applicationautoscaling.model.PolicyType) BatchWriteItemResponse(software.amazon.awssdk.services.dynamodb.model.BatchWriteItemResponse) ReplicaUpdate(software.amazon.awssdk.services.dynamodb.model.ReplicaUpdate) KeySchemaElement(software.amazon.awssdk.services.dynamodb.model.KeySchemaElement) BillingMode(software.amazon.awssdk.services.dynamodb.model.BillingMode) Projection(software.amazon.awssdk.services.dynamodb.model.Projection) CreateTableResponse(software.amazon.awssdk.services.dynamodb.model.CreateTableResponse) AwsBasicCredentials(software.amazon.awssdk.auth.credentials.AwsBasicCredentials) Collections(java.util.Collections) CreateTableResponse(software.amazon.awssdk.services.dynamodb.model.CreateTableResponse) AttributeDefinition(software.amazon.awssdk.services.dynamodb.model.AttributeDefinition) GlobalSecondaryIndex(software.amazon.awssdk.services.dynamodb.model.GlobalSecondaryIndex) ProvisionedThroughputExceededException(software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughputExceededException)

Example 2 with Projection

use of software.amazon.awssdk.services.dynamodb.model.Projection in project aws-sdk-java-v2 by aws.

the class CreateTableOperationTest method generateRequest_withLsiAndGsi.

@Test
public void generateRequest_withLsiAndGsi() {
    Projection projection1 = Projection.builder().projectionType(ProjectionType.ALL).build();
    Projection projection2 = Projection.builder().projectionType(ProjectionType.KEYS_ONLY).build();
    Projection projection3 = Projection.builder().projectionType(ProjectionType.INCLUDE).nonKeyAttributes("key1", "key2").build();
    ProvisionedThroughput provisionedThroughput1 = ProvisionedThroughput.builder().readCapacityUnits(1L).writeCapacityUnits(2L).build();
    ProvisionedThroughput provisionedThroughput2 = ProvisionedThroughput.builder().readCapacityUnits(3L).writeCapacityUnits(4L).build();
    List<EnhancedGlobalSecondaryIndex> globalSecondaryIndexList = Arrays.asList(EnhancedGlobalSecondaryIndex.builder().indexName("gsi_1").projection(projection1).provisionedThroughput(provisionedThroughput1).build(), EnhancedGlobalSecondaryIndex.builder().indexName("gsi_2").projection(projection2).provisionedThroughput(provisionedThroughput2).build());
    CreateTableOperation<FakeItemWithIndices> operation = CreateTableOperation.create(CreateTableEnhancedRequest.builder().globalSecondaryIndices(globalSecondaryIndexList).localSecondaryIndices(Collections.singletonList(EnhancedLocalSecondaryIndex.create("lsi_1", projection3))).build());
    CreateTableRequest request = operation.generateRequest(FakeItemWithIndices.getTableSchema(), PRIMARY_CONTEXT, null);
    assertThat(request.tableName(), is(TABLE_NAME));
    assertThat(request.keySchema(), containsInAnyOrder(KeySchemaElement.builder().attributeName("id").keyType(HASH).build(), KeySchemaElement.builder().attributeName("sort").keyType(RANGE).build()));
    software.amazon.awssdk.services.dynamodb.model.GlobalSecondaryIndex expectedGsi1 = software.amazon.awssdk.services.dynamodb.model.GlobalSecondaryIndex.builder().indexName("gsi_1").keySchema(KeySchemaElement.builder().attributeName("gsi_id").keyType(HASH).build(), KeySchemaElement.builder().attributeName("gsi_sort").keyType(RANGE).build()).projection(projection1).provisionedThroughput(provisionedThroughput1).build();
    software.amazon.awssdk.services.dynamodb.model.GlobalSecondaryIndex expectedGsi2 = software.amazon.awssdk.services.dynamodb.model.GlobalSecondaryIndex.builder().indexName("gsi_2").keySchema(KeySchemaElement.builder().attributeName("gsi_id").keyType(HASH).build()).projection(projection2).provisionedThroughput(provisionedThroughput2).build();
    assertThat(request.globalSecondaryIndexes(), containsInAnyOrder(matchesGsi(expectedGsi1), matchesGsi(expectedGsi2)));
    software.amazon.awssdk.services.dynamodb.model.LocalSecondaryIndex expectedLsi = software.amazon.awssdk.services.dynamodb.model.LocalSecondaryIndex.builder().indexName("lsi_1").keySchema(KeySchemaElement.builder().attributeName("id").keyType(HASH).build(), KeySchemaElement.builder().attributeName("lsi_sort").keyType(RANGE).build()).projection(projection3).build();
    assertThat(request.localSecondaryIndexes(), containsInAnyOrder(expectedLsi));
    assertThat(request.attributeDefinitions(), containsInAnyOrder(AttributeDefinition.builder().attributeName("id").attributeType(ScalarAttributeType.S).build(), AttributeDefinition.builder().attributeName("sort").attributeType(ScalarAttributeType.S).build(), AttributeDefinition.builder().attributeName("lsi_sort").attributeType(ScalarAttributeType.S).build(), AttributeDefinition.builder().attributeName("gsi_id").attributeType(ScalarAttributeType.S).build(), AttributeDefinition.builder().attributeName("gsi_sort").attributeType(ScalarAttributeType.S).build()));
}
Also used : Projection(software.amazon.awssdk.services.dynamodb.model.Projection) ProvisionedThroughput(software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput) EnhancedGlobalSecondaryIndex(software.amazon.awssdk.enhanced.dynamodb.model.EnhancedGlobalSecondaryIndex) FakeItemWithIndices(software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithIndices) CreateTableRequest(software.amazon.awssdk.services.dynamodb.model.CreateTableRequest) Test(org.junit.Test)

Example 3 with Projection

use of software.amazon.awssdk.services.dynamodb.model.Projection in project aws-sdk-java-v2 by aws.

the class CreateTableOperationTest method generateRequest_validLsiAsGsiReference.

@Test
public void generateRequest_validLsiAsGsiReference() {
    List<EnhancedGlobalSecondaryIndex> validLsiList = Collections.singletonList(EnhancedGlobalSecondaryIndex.builder().indexName("lsi_1").projection(p -> p.projectionType(ProjectionType.ALL)).provisionedThroughput(p -> p.readCapacityUnits(1L).writeCapacityUnits(1L)).build());
    CreateTableOperation<FakeItemWithIndices> operation = CreateTableOperation.create(CreateTableEnhancedRequest.builder().globalSecondaryIndices(validLsiList).build());
    CreateTableRequest request = operation.generateRequest(FakeItemWithIndices.getTableSchema(), PRIMARY_CONTEXT, null);
    assertThat(request.globalSecondaryIndexes().size(), is(1));
    software.amazon.awssdk.services.dynamodb.model.GlobalSecondaryIndex globalSecondaryIndex = request.globalSecondaryIndexes().get(0);
    assertThat(globalSecondaryIndex.indexName(), is("lsi_1"));
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) FakeItemWithIndices(software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithIndices) Arrays(java.util.Arrays) FakeItemWithByteBufferKey(software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithByteBufferKey) Mock(org.mockito.Mock) RunWith(org.junit.runner.RunWith) FakeItemWithNumericSort(software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithNumericSort) ProvisionedThroughput(software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput) RANGE(software.amazon.awssdk.services.dynamodb.model.KeyType.RANGE) CreateTableRequest(software.amazon.awssdk.services.dynamodb.model.CreateTableRequest) FakeItem(software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItem) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) ScalarAttributeType(software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType) DefaultSdkAutoConstructList(software.amazon.awssdk.core.util.DefaultSdkAutoConstructList) Description(org.hamcrest.Description) DynamoDbClient(software.amazon.awssdk.services.dynamodb.DynamoDbClient) Matchers.empty(org.hamcrest.Matchers.empty) ProjectionType(software.amazon.awssdk.services.dynamodb.model.ProjectionType) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) HASH(software.amazon.awssdk.services.dynamodb.model.KeyType.HASH) AttributeDefinition(software.amazon.awssdk.services.dynamodb.model.AttributeDefinition) EnhancedLocalSecondaryIndex(software.amazon.awssdk.enhanced.dynamodb.model.EnhancedLocalSecondaryIndex) TypeSafeMatcher(org.hamcrest.TypeSafeMatcher) Mockito.verify(org.mockito.Mockito.verify) List(java.util.List) TableMetadata(software.amazon.awssdk.enhanced.dynamodb.TableMetadata) KeySchemaElement(software.amazon.awssdk.services.dynamodb.model.KeySchemaElement) CreateTableEnhancedRequest(software.amazon.awssdk.enhanced.dynamodb.model.CreateTableEnhancedRequest) BillingMode(software.amazon.awssdk.services.dynamodb.model.BillingMode) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) Matchers.sameInstance(org.hamcrest.Matchers.sameInstance) OperationContext(software.amazon.awssdk.enhanced.dynamodb.OperationContext) Projection(software.amazon.awssdk.services.dynamodb.model.Projection) CreateTableResponse(software.amazon.awssdk.services.dynamodb.model.CreateTableResponse) Matchers.is(org.hamcrest.Matchers.is) EnhancedGlobalSecondaryIndex(software.amazon.awssdk.enhanced.dynamodb.model.EnhancedGlobalSecondaryIndex) Collections(java.util.Collections) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) ArgumentMatchers.same(org.mockito.ArgumentMatchers.same) FakeItemWithBinaryKey(software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithBinaryKey) EnhancedGlobalSecondaryIndex(software.amazon.awssdk.enhanced.dynamodb.model.EnhancedGlobalSecondaryIndex) FakeItemWithIndices(software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithIndices) CreateTableRequest(software.amazon.awssdk.services.dynamodb.model.CreateTableRequest) Test(org.junit.Test)

Example 4 with Projection

use of software.amazon.awssdk.services.dynamodb.model.Projection in project aws-sdk-java-v2 by aws.

the class CreateTableOperationTest method generateRequest_invalidGsi.

@Test(expected = IllegalArgumentException.class)
public void generateRequest_invalidGsi() {
    ProvisionedThroughput provisionedThroughput = ProvisionedThroughput.builder().readCapacityUnits(1L).writeCapacityUnits(1L).build();
    List<EnhancedGlobalSecondaryIndex> invalidGsiList = Collections.singletonList(EnhancedGlobalSecondaryIndex.builder().indexName("invalid").projection(p -> p.projectionType(ProjectionType.ALL)).provisionedThroughput(provisionedThroughput).build());
    CreateTableOperation<FakeItem> operation = CreateTableOperation.create(CreateTableEnhancedRequest.builder().globalSecondaryIndices(invalidGsiList).build());
    operation.generateRequest(FakeItem.getTableSchema(), PRIMARY_CONTEXT, null);
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) FakeItemWithIndices(software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithIndices) Arrays(java.util.Arrays) FakeItemWithByteBufferKey(software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithByteBufferKey) Mock(org.mockito.Mock) RunWith(org.junit.runner.RunWith) FakeItemWithNumericSort(software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithNumericSort) ProvisionedThroughput(software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput) RANGE(software.amazon.awssdk.services.dynamodb.model.KeyType.RANGE) CreateTableRequest(software.amazon.awssdk.services.dynamodb.model.CreateTableRequest) FakeItem(software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItem) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) ScalarAttributeType(software.amazon.awssdk.services.dynamodb.model.ScalarAttributeType) DefaultSdkAutoConstructList(software.amazon.awssdk.core.util.DefaultSdkAutoConstructList) Description(org.hamcrest.Description) DynamoDbClient(software.amazon.awssdk.services.dynamodb.DynamoDbClient) Matchers.empty(org.hamcrest.Matchers.empty) ProjectionType(software.amazon.awssdk.services.dynamodb.model.ProjectionType) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) HASH(software.amazon.awssdk.services.dynamodb.model.KeyType.HASH) AttributeDefinition(software.amazon.awssdk.services.dynamodb.model.AttributeDefinition) EnhancedLocalSecondaryIndex(software.amazon.awssdk.enhanced.dynamodb.model.EnhancedLocalSecondaryIndex) TypeSafeMatcher(org.hamcrest.TypeSafeMatcher) Mockito.verify(org.mockito.Mockito.verify) List(java.util.List) TableMetadata(software.amazon.awssdk.enhanced.dynamodb.TableMetadata) KeySchemaElement(software.amazon.awssdk.services.dynamodb.model.KeySchemaElement) CreateTableEnhancedRequest(software.amazon.awssdk.enhanced.dynamodb.model.CreateTableEnhancedRequest) BillingMode(software.amazon.awssdk.services.dynamodb.model.BillingMode) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) Matchers.sameInstance(org.hamcrest.Matchers.sameInstance) OperationContext(software.amazon.awssdk.enhanced.dynamodb.OperationContext) Projection(software.amazon.awssdk.services.dynamodb.model.Projection) CreateTableResponse(software.amazon.awssdk.services.dynamodb.model.CreateTableResponse) Matchers.is(org.hamcrest.Matchers.is) EnhancedGlobalSecondaryIndex(software.amazon.awssdk.enhanced.dynamodb.model.EnhancedGlobalSecondaryIndex) Collections(java.util.Collections) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) ArgumentMatchers.same(org.mockito.ArgumentMatchers.same) FakeItemWithBinaryKey(software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithBinaryKey) ProvisionedThroughput(software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput) EnhancedGlobalSecondaryIndex(software.amazon.awssdk.enhanced.dynamodb.model.EnhancedGlobalSecondaryIndex) FakeItem(software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItem) Test(org.junit.Test)

Example 5 with Projection

use of software.amazon.awssdk.services.dynamodb.model.Projection in project serve by pytorch.

the class DDBSnapshotSerializerTest method createTable.

private void createTable() {
    ProvisionedThroughput provThroughput = ProvisionedThroughput.builder().readCapacityUnits(10L).writeCapacityUnits(5L).build();
    Projection projectAll = Projection.builder().projectionType(ProjectionType.ALL).build();
    EnhancedGlobalSecondaryIndex gsi = EnhancedGlobalSecondaryIndex.builder().indexName("createdOnMonth-index").projection(projectAll).provisionedThroughput(provThroughput).build();
    CreateTableEnhancedRequest createTableReq = CreateTableEnhancedRequest.builder().globalSecondaryIndices(Arrays.asList(gsi)).build();
    snapshotTable.createTable(createTableReq);
}
Also used : Projection(software.amazon.awssdk.services.dynamodb.model.Projection) ProvisionedThroughput(software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput) EnhancedGlobalSecondaryIndex(software.amazon.awssdk.enhanced.dynamodb.model.EnhancedGlobalSecondaryIndex) CreateTableEnhancedRequest(software.amazon.awssdk.enhanced.dynamodb.model.CreateTableEnhancedRequest)

Aggregations

EnhancedGlobalSecondaryIndex (software.amazon.awssdk.enhanced.dynamodb.model.EnhancedGlobalSecondaryIndex)4 CreateTableRequest (software.amazon.awssdk.services.dynamodb.model.CreateTableRequest)4 Projection (software.amazon.awssdk.services.dynamodb.model.Projection)4 ProvisionedThroughput (software.amazon.awssdk.services.dynamodb.model.ProvisionedThroughput)4 Collections (java.util.Collections)3 List (java.util.List)3 Test (org.junit.Test)3 FakeItemWithIndices (software.amazon.awssdk.enhanced.dynamodb.functionaltests.models.FakeItemWithIndices)3 CreateTableEnhancedRequest (software.amazon.awssdk.enhanced.dynamodb.model.CreateTableEnhancedRequest)3 DynamoDbClient (software.amazon.awssdk.services.dynamodb.DynamoDbClient)3 AttributeDefinition (software.amazon.awssdk.services.dynamodb.model.AttributeDefinition)3 BillingMode (software.amazon.awssdk.services.dynamodb.model.BillingMode)3 CreateTableResponse (software.amazon.awssdk.services.dynamodb.model.CreateTableResponse)3 Arrays (java.util.Arrays)2 Description (org.hamcrest.Description)2 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)2 Matchers.containsInAnyOrder (org.hamcrest.Matchers.containsInAnyOrder)2 Matchers.empty (org.hamcrest.Matchers.empty)2 Matchers.is (org.hamcrest.Matchers.is)2 Matchers.sameInstance (org.hamcrest.Matchers.sameInstance)2