diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..57ca657 Binary files /dev/null and b/.DS_Store differ diff --git a/Lambdas/.DS_Store b/Lambdas/.DS_Store new file mode 100644 index 0000000..d4384bd Binary files /dev/null and b/Lambdas/.DS_Store differ diff --git a/Lambdas/Lists/List/resources/META-INF/plugin.xml b/Lambdas/Lists/List/resources/META-INF/plugin.xml new file mode 100644 index 0000000..00681c9 --- /dev/null +++ b/Lambdas/Lists/List/resources/META-INF/plugin.xml @@ -0,0 +1,33 @@ + + com.your.company.unique.plugin.id + Plugin display name here + 1.0 + YourCompany + + + most HTML tags may be used + ]]> + + + most HTML tags may be used + ]]> + + + + + + + com.intellij.modules.platform + + + + + + + + + + \ No newline at end of file diff --git a/Lambdas/Lists/List/src/List.java b/Lambdas/Lists/List/src/List.java index fd73808..3ba2d0f 100644 --- a/Lambdas/Lists/List/src/List.java +++ b/Lambdas/Lists/List/src/List.java @@ -83,14 +83,16 @@ public class List { return uiPosition; } - public void setUiPosition(Integer uiPosition) { - this.uiPosition = uiPosition; - - public ItemEntry[] getEntries() { - return entries.toArray(new ItemEntry[entries.size()]); - } - - public void addItemEntry(ItemEntry entry) { - entries.add(entry); - } +// public void setUiPosition(Integer uiPosition) { +// this.uiPosition = uiPosition; +// +// public ItemEntry[] getEntries() { +// //return entries.toArray(new ItemEntry[entries.size()]); +// return; +// } +// +// public void addItemEntry(ItemEntry entry) { +// //entries.add(entry); +// return; +// } } diff --git a/Lambdas/Lists/List/src/ListGetter.java b/Lambdas/Lists/List/src/ListGetter.java index e29267c..c7fe058 100644 --- a/Lambdas/Lists/List/src/ListGetter.java +++ b/Lambdas/Lists/List/src/ListGetter.java @@ -72,7 +72,7 @@ public class ListGetter implements CallHandler{ getListEntries.setInt(1, id); ResultSet getEntryResults = getListEntries.executeQuery(); while (getEntryResults.next()) { - retrievedList.addItemEntry(new ItemEntry(id, getEntryResults)); + //retrievedList.addItemEntry(new ItemEntry(id, getEntryResults)); } System.out.println(retrievedList); return retrievedList; diff --git a/Lambdas/Lists/List/target/artifacts/Lists_jar/Lists.jar b/Lambdas/Lists/List/target/artifacts/Lists_jar/Lists.jar new file mode 100644 index 0000000..10f0103 Binary files /dev/null and b/Lambdas/Lists/List/target/artifacts/Lists_jar/Lists.jar differ diff --git a/Lambdas/Lists/List/test/TestListAdder.java b/Lambdas/Lists/List/test/TestListAdder.java index 9b5f667..9ef83ad 100644 --- a/Lambdas/Lists/List/test/TestListAdder.java +++ b/Lambdas/Lists/List/test/TestListAdder.java @@ -1,4 +1,7 @@ -import org.junit.Test; +import org.junit.jupiter.api.Test; +import org.mockito.configuration.IMockitoConfiguration; + +import static org.mockito.Mockito.*; import java.sql.SQLException; import java.util.ArrayList; @@ -13,8 +16,8 @@ public class TestListAdder { } @Test - public void testListAdderError() { - testListAdderCore(true); + public void testListAdderError() throws SQLException { + testListAdderCoreMock(true); } public void testListAdderCore(boolean shouldThrow) { @@ -46,4 +49,25 @@ public class TestListAdder { throwables.printStackTrace(); } } + + public void testListAdderCoreMock(boolean shouldThrow) throws SQLException { + StatementInjector injector; + ArrayList rsReturns = new ArrayList<>(); + rsReturns.add(1); //new listID + injector = mock(StatementInjector.class); + injector.returnedStatement = null; + injector.rsReturns = new ArrayList(rsReturns); + injector.shouldThrow = shouldThrow; + + ListAdder listAdder = new ListAdder(injector, "cognitoID"); + Map ignore = new HashMap<>(); + Map body = TestInputUtils.addBody(ignore); + body.put("name", "aname"); + if(injector.getStatementString() == null) { + assert(false); + return; + } + when(injector.getStatementString().contains("INSERT INTO List (name, owner, lastUpdated) VALUES (?, ?, ?);INSERT INTO ListSharee(listID, userID) VALUES(?, ?);[1, cognitoID]")).thenReturn(true); + assert (injector.getStatementString().contains("INSERT INTO List (name, owner, lastUpdated) VALUES (?, ?, ?);INSERT INTO ListSharee(listID, userID) VALUES(?, ?);[1, cognitoID]")); + } } diff --git a/Lambdas/Lists/pom.xml b/Lambdas/Lists/pom.xml index 4725165..78e21c3 100644 --- a/Lambdas/Lists/pom.xml +++ b/Lambdas/Lists/pom.xml @@ -110,6 +110,11 @@ 4.13 test + + org.mockito + mockito-core + 3.2.4 + 1.11 diff --git a/Listify/.idea/gradle.xml b/Listify/.idea/gradle.xml index 674414f..7ce9e9b 100644 --- a/Listify/.idea/gradle.xml +++ b/Listify/.idea/gradle.xml @@ -4,10 +4,15 @@ diff --git a/Listify/.idea/misc.xml b/Listify/.idea/misc.xml index d5d35ec..82f7cd8 100644 --- a/Listify/.idea/misc.xml +++ b/Listify/.idea/misc.xml @@ -1,6 +1,6 @@ - +