package simplymequeeny.dynamodb;

import java.util.List;
import org.junit.Test;
import org.junit.Assert;
import org.springframework.beans.factory.annotation.Autowired;
import simplymequeeny.AbstractBaseTest;

public class AwsDbClientTest extends AbstractBaseTest {

    @Autowired
    AwsDbClient dbClient;

    @Test
    public void shouldConnectToDb() {
        List<String> tables = dbClient.listTables().getTableNames();
        Assert.assertNotNull(tables);
    }   
}

@@ -25,17 +25,50 @@
 ynamodb;
-%0A
+%0D%0A%0D%0Aimport java.util.Collections;%0D
 %0Aimport 
@@ -82,16 +82,17 @@
 il.List;
+%0D
 %0Aimport 
@@ -106,16 +106,17 @@
 it.Test;
+%0D
 %0Aimport 
@@ -132,16 +132,17 @@
 .Assert;
+%0D
 %0Aimport 
@@ -149,59 +149,129 @@
 org.
-springframework.beans.factory.annotation.Autowired;
+junit.Before;%0D%0Aimport org.mockito.Mock;%0D%0Aimport static org.mockito.Mockito.when;%0D%0Aimport org.mockito.MockitoAnnotations;%0D
 %0Aimp
@@ -306,17 +306,19 @@
 aseTest;
-%0A
+%0D%0A%0D
 %0Apublic 
@@ -369,24 +369,22 @@
 st %7B
-%0A
+%0D%0A%0D
 %0A    @
-Autowired
+Mock%0D
 %0A   
@@ -405,17 +405,120 @@
 bClient;
-%0A
+%0D%0A%0D%0A    @Before%0D%0A    public void init() %7B%0D%0A        MockitoAnnotations.initMocks(this);    %0D%0A    %7D%0D%0A    %0D
 %0A    @Te
@@ -519,16 +519,17 @@
    @Test
+%0D
 %0A    pub
@@ -558,16 +558,93 @@
 ToDb() %7B
+%0D%0A        when(dbClient.getTableNames()).thenReturn(Collections.EMPTY_LIST);%0D
 %0A       
@@ -679,21 +679,8 @@
 ent.
-listTables().
 getT
@@ -691,16 +691,17 @@
 Names();
+%0D
 %0A       
@@ -730,16 +730,17 @@
 tables);
+%0D
 %0A    %7D  
@@ -744,7 +744,9 @@
 %7D   
+%0D
 %0A%7D
+%0D
 %0A

use mock for credential provider error