Skip to content

Commit b1c3131

Browse files
Adding tests for OperationName.
1 parent 908a5af commit b1c3131

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

  • services-custom/dynamodb-enhanced/src/test/java/software/amazon/awssdk/enhanced/dynamodb/internal/operations
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package software.amazon.awssdk.enhanced.dynamodb.internal.operations;
17+
18+
import static org.junit.Assert.assertArrayEquals;
19+
import static org.junit.Assert.assertEquals;
20+
import static org.junit.Assert.assertNull;
21+
22+
import org.junit.Test;
23+
24+
public class OperationNameTest {
25+
26+
@Test
27+
public void values_returnsExpectedConstantsInDeclarationOrder() {
28+
assertArrayEquals(new OperationName[] {
29+
OperationName.NONE,
30+
OperationName.BATCH_GET_ITEM,
31+
OperationName.BATCH_WRITE_ITEM,
32+
OperationName.CREATE_TABLE,
33+
OperationName.DELETE_ITEM,
34+
OperationName.DELETE_TABLE,
35+
OperationName.DESCRIBE_TABLE,
36+
OperationName.GET_ITEM,
37+
OperationName.QUERY,
38+
OperationName.PUT_ITEM,
39+
OperationName.SCAN,
40+
OperationName.TRANSACT_GET_ITEMS,
41+
OperationName.TRANSACT_WRITE_ITEMS,
42+
OperationName.UPDATE_ITEM
43+
}, OperationName.values());
44+
}
45+
46+
@Test
47+
public void label_returnsExpectedLabelForEachConstant() {
48+
int operationNameCount = OperationName.values().length;
49+
assertEquals(14, operationNameCount);
50+
51+
assertNull(OperationName.NONE.label());
52+
assertEquals("BatchGetItem", OperationName.BATCH_GET_ITEM.label());
53+
assertEquals("BatchWriteItem", OperationName.BATCH_WRITE_ITEM.label());
54+
assertEquals("CreateTable", OperationName.CREATE_TABLE.label());
55+
assertEquals("DeleteItem", OperationName.DELETE_ITEM.label());
56+
assertEquals("DeleteTable", OperationName.DELETE_TABLE.label());
57+
assertEquals("DescribeTable", OperationName.DESCRIBE_TABLE.label());
58+
assertEquals("GetItem", OperationName.GET_ITEM.label());
59+
assertEquals("Query", OperationName.QUERY.label());
60+
assertEquals("PutItem", OperationName.PUT_ITEM.label());
61+
assertEquals("Scan", OperationName.SCAN.label());
62+
assertEquals("TransactGetItems", OperationName.TRANSACT_GET_ITEMS.label());
63+
assertEquals("TransactWriteItems", OperationName.TRANSACT_WRITE_ITEMS.label());
64+
assertEquals("UpdateItem", OperationName.UPDATE_ITEM.label());
65+
}
66+
}

0 commit comments

Comments
 (0)