@@ -0,0 +1,2442 @@
+/*%0A * Copyright 2016 Exorath%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.exorath.service.treasurehunt.test;%0A%0Aimport com.amazonaws.services.dynamodbv2.AmazonDynamoDBClient;%0Aimport com.amazonaws.services.dynamodbv2.document.DynamoDB;%0Aimport com.exorath.service.commons.dynamoDBProvider.DynamoDBProvider;%0Aimport com.exorath.service.treasurehunt.Service;%0Aimport com.exorath.service.treasurehunt.Treasure;%0Aimport com.exorath.service.treasurehunt.dynamodb.DynamoDBService;%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0A%0Aimport java.util.UUID;%0A%0Apublic class DynamoDBServiceTest %7B%0A%0A%09@Test%0A%09public void testGetTreasuresEqualsSetTreasures() %7B%0A%09%09UUID playerId = UUID.randomUUID();%0A%09%09Service srv = new DynamoDBService(getDynamoDBProvider());%0A%09%09srv.setTreasure(playerId, %22testTreasure1%22);%0A%09%09srv.setTreasure(playerId, %22testTreasure2%22);%0A%09%09srv.setTreasure(playerId, %22testTreasure3%22);%0A%09%09srv.setTreasure(playerId, %22testTreasure4%22);%0A%0A%09%09Treasure%5B%5D treasures = srv.getTreasures(playerId);%0A%09%09Assert.assertEquals(treasures.length, 4);%0A%0A%09%09boolean testTreasuse1AccountFor = false;%0A%09%09boolean testTreasuse2AccountFor = false;%0A%09%09boolean testTreasuse3AccountFor = false;%0A%09%09boolean testTreasuse4AccountFor = false;%0A%09%09for (Treasure t : treasures) %7B%0A%09%09%09if (t.getId().equals(%22testTreasure1%22)) %7B%0A%09%09%09%09testTreasuse1AccountFor = true;%0A%09%09%09%7D else if (t.getId().equals(%22testTreasure2%22)) %7B%0A%09%09%09%09testTreasuse2AccountFor = true;%0A%09%09%09%7D else if (t.getId().equals(%22testTreasure3%22)) %7B%0A%09%09%09%09testTreasuse3AccountFor = true;%0A%09%09%09%7D else if (t.getId().equals(%22testTreasure4%22)) %7B%0A%09%09%09%09testTreasuse4AccountFor = true;%0A%09%09%09%7D%0A%09%09%7D%0A%09%09Assert.assertTrue(testTreasuse1AccountFor && testTreasuse2AccountFor && testTreasuse3AccountFor && testTreasuse4AccountFor);%0A%09%7D%0A%0A%09private DynamoDBProvider getDynamoDBProvider() %7B%0A%09%09AmazonDynamoDBClient client = new AmazonDynamoDBClient().withEndpoint(%22http://localhost:8000%22);%0A%09%09DynamoDB db = new DynamoDB(client);%0A%09%09return () -%3E db;%0A%09%7D%0A%7D%0A

Create test for DynamoDBService functionality