From e8667c141aad7198dfdea610c70250999f27f8cf Mon Sep 17 00:00:00 2001 From: Simon <simonuerdingen@Simons-MacBook-Pro.local> Date: Tue, 20 Jun 2017 09:53:56 +0200 Subject: [PATCH] =?UTF-8?q?Fertigstellung=20des=20JUnit=20Tests=20f=C3=BCr?= =?UTF-8?q?=20die=20Registration=20Control=20mittels=20CRUD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/workspace.xml | 94 +++++++++---------- .../dao/impl/RegistrationControl_Test.java | 24 ++--- 2 files changed, 58 insertions(+), 60 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 40100a0..7f884ac 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,8 +2,6 @@ <project version="4"> <component name="ChangeListManager"> <list default="true" id="5f36371d-de5c-44ce-a12c-613727d95355" name="Default" comment=""> - <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" /> - <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/org/s4s/dao/RegistrationDAO.java" afterPath="$PROJECT_DIR$/src/main/java/org/s4s/dao/RegistrationDAO.java" /> <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/test/java/org/s4s/dao/impl/RegistrationControl_Test.java" afterPath="$PROJECT_DIR$/src/test/java/org/s4s/dao/impl/RegistrationControl_Test.java" /> </list> <ignored path="shopInShop.iws" /> @@ -29,7 +27,7 @@ <file leaf-file-name="RegistrationControl.java" pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/src/main/java/org/s4s/process/control/RegistrationControl.java"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="488"> + <state relative-caret-position="765"> <caret line="53" column="43" lean-forward="false" selection-start-line="53" selection-start-column="43" selection-end-line="53" selection-end-column="43" /> <folding /> </state> @@ -39,8 +37,8 @@ <file leaf-file-name="RegistrationDAO.java" pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/src/main/java/org/s4s/dao/RegistrationDAO.java"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="242"> - <caret line="27" column="26" lean-forward="true" selection-start-line="27" selection-start-column="26" selection-end-line="27" selection-end-column="26" /> + <state relative-caret-position="449"> + <caret line="41" column="12" lean-forward="false" selection-start-line="41" selection-start-column="12" selection-end-line="43" selection-end-column="13" /> <folding> <marker date="1497910575000" expanded="true" signature="841:867" ph="INSERT INTO \"ERR\".... " /> <marker date="1497910575000" expanded="true" signature="841:916" ph="INSERT INTO \"ERR\".... " /> @@ -54,14 +52,14 @@ <file leaf-file-name="RegistrationControl_Test.java" pinned="false" current-in-tab="true"> <entry file="file://$PROJECT_DIR$/src/test/java/org/s4s/dao/impl/RegistrationControl_Test.java"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="561"> - <caret line="53" column="112" lean-forward="false" selection-start-line="53" selection-start-column="112" selection-end-line="53" selection-end-column="112" /> + <state relative-caret-position="756"> + <caret line="66" column="59" lean-forward="false" selection-start-line="66" selection-start-column="59" selection-end-line="66" selection-end-column="59" /> <folding> - <marker date="1497912919000" expanded="true" signature="1443:1524" ph="SELECT * FRO... user" /> - <marker date="1497912919000" expanded="true" signature="1443:1525" ph="SELECT * FRO... user" /> - <marker date="1497912919000" expanded="true" signature="1443:1529" ph="SELECT * FRO... user" /> - <marker date="1497912919000" expanded="true" signature="1443:1530" ph="SELECT * FRO... user" /> - <marker date="1497912919000" expanded="true" signature="1564:1630" ph="SELECT * FRO... user" /> + <marker date="1497945181000" expanded="true" signature="1464:1545" ph="SELECT * FRO... user" /> + <marker date="1497945181000" expanded="true" signature="1464:1546" ph="SELECT * FRO... user" /> + <marker date="1497945181000" expanded="true" signature="1464:1550" ph="SELECT * FRO... user" /> + <marker date="1497945181000" expanded="true" signature="1464:1551" ph="SELECT * FRO... user" /> + <marker date="1497945181000" expanded="true" signature="1585:1651" ph="SELECT * FRO... user" /> </folding> </state> </provider> @@ -80,7 +78,7 @@ <file leaf-file-name="User.java" pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/src/main/java/org/s4s/modell/dto/User.java"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="143"> + <state relative-caret-position="165"> <caret line="11" column="13" lean-forward="false" selection-start-line="11" selection-start-column="13" selection-end-line="11" selection-end-column="13" /> <folding /> </state> @@ -90,7 +88,7 @@ <file leaf-file-name="RegistrierungView.java" pinned="false" current-in-tab="false"> <entry file="file://$PROJECT_DIR$/src/main/java/org/s4s/gui/views/RegistrierungView.java"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="-331"> + <state relative-caret-position="405"> <caret line="44" column="27" lean-forward="false" selection-start-line="44" selection-start-column="27" selection-end-line="44" selection-end-column="27" /> <folding /> </state> @@ -276,8 +274,6 @@ <foldersAlwaysOnTop value="true" /> </navigator> <panes> - <pane id="PackagesPane" /> - <pane id="Scratches" /> <pane id="ProjectPane"> <subPane> <PATH> @@ -598,6 +594,8 @@ </PATH> </subPane> </pane> + <pane id="Scratches" /> + <pane id="PackagesPane" /> <pane id="Scope" /> </panes> </component> @@ -1158,43 +1156,44 @@ <workItem from="1497892141475" duration="1318000" /> <workItem from="1497902421348" duration="3435000" /> <workItem from="1497907375567" duration="5487000" /> + <workItem from="1497944732211" duration="476000" /> </task> <servers /> </component> <component name="TestHistory"> - <history-entry file="RegistrationControl_Test - 2017.06.06 at 13h 39m 41s.xml"> + <history-entry file="RegistrationControl_Test - 2017.06.20 at 00h 47m 11s.xml"> <configuration name="RegistrationControl_Test" configurationId="JUnit" /> </history-entry> - <history-entry file="RegistrationControl_Test - 2017.06.06 at 13h 42m 31s.xml"> + <history-entry file="RegistrationControl_Test - 2017.06.20 at 00h 50m 35s.xml"> <configuration name="RegistrationControl_Test" configurationId="JUnit" /> </history-entry> - <history-entry file="RegistrationControl_Test - 2017.06.06 at 13h 45m 13s.xml"> + <history-entry file="RegistrationControl_Test - 2017.06.20 at 00h 53m 28s.xml"> <configuration name="RegistrationControl_Test" configurationId="JUnit" /> </history-entry> - <history-entry file="RegistrationControl_Test - 2017.06.06 at 13h 45m 39s.xml"> + <history-entry file="RegistrationControl_Test - 2017.06.20 at 00h 53m 50s.xml"> <configuration name="RegistrationControl_Test" configurationId="JUnit" /> </history-entry> - <history-entry file="RegistrationControl_Test - 2017.06.20 at 00h 40m 46s.xml"> + <history-entry file="RegistrationControl_Test - 2017.06.20 at 09h 46m 17s.xml"> <configuration name="RegistrationControl_Test" configurationId="JUnit" /> </history-entry> - <history-entry file="RegistrationControl_Test - 2017.06.20 at 00h 44m 05s.xml"> + <history-entry file="RegistrationControl_Test - 2017.06.20 at 09h 47m 06s.xml"> <configuration name="RegistrationControl_Test" configurationId="JUnit" /> </history-entry> - <history-entry file="RegistrationControl_Test - 2017.06.20 at 00h 47m 11s.xml"> + <history-entry file="RegistrationControl_Test - 2017.06.20 at 09h 47m 59s.xml"> <configuration name="RegistrationControl_Test" configurationId="JUnit" /> </history-entry> - <history-entry file="RegistrationControl_Test - 2017.06.20 at 00h 50m 35s.xml"> + <history-entry file="RegistrationControl_Test - 2017.06.20 at 09h 48m 30s.xml"> <configuration name="RegistrationControl_Test" configurationId="JUnit" /> </history-entry> - <history-entry file="RegistrationControl_Test - 2017.06.20 at 00h 53m 28s.xml"> + <history-entry file="RegistrationControl_Test - 2017.06.20 at 09h 51m 04s.xml"> <configuration name="RegistrationControl_Test" configurationId="JUnit" /> </history-entry> - <history-entry file="RegistrationControl_Test - 2017.06.20 at 00h 53m 50s.xml"> + <history-entry file="RegistrationControl_Test - 2017.06.20 at 09h 53m 04s.xml"> <configuration name="RegistrationControl_Test" configurationId="JUnit" /> </history-entry> </component> <component name="TimeTrackingManager"> - <option name="totallyTimeSpent" value="70516000" /> + <option name="totallyTimeSpent" value="70992000" /> </component> <component name="ToolWindowManager"> <frame x="0" y="0" width="1920" height="1080" extended-state="0" /> @@ -1385,7 +1384,6 @@ <provider selected="true" editor-type-id="text-editor"> <state relative-caret-position="360"> <caret line="28" column="87" lean-forward="false" selection-start-line="28" selection-start-column="61" selection-end-line="28" selection-end-column="87" /> - <folding /> </state> </provider> </entry> @@ -1584,7 +1582,7 @@ </entry> <entry file="file://$PROJECT_DIR$/src/main/java/org/s4s/modell/dto/User.java"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="143"> + <state relative-caret-position="165"> <caret line="11" column="13" lean-forward="false" selection-start-line="11" selection-start-column="13" selection-end-line="11" selection-end-column="13" /> <folding /> </state> @@ -1592,7 +1590,7 @@ </entry> <entry file="file://$PROJECT_DIR$/src/main/java/org/s4s/process/control/RegistrationControl.java"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="488"> + <state relative-caret-position="765"> <caret line="53" column="43" lean-forward="false" selection-start-line="53" selection-start-column="43" selection-end-line="53" selection-end-column="43" /> <folding /> </state> @@ -1600,16 +1598,24 @@ </entry> <entry file="file://$PROJECT_DIR$/src/main/java/org/s4s/gui/views/RegistrierungView.java"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="-331"> + <state relative-caret-position="405"> <caret line="44" column="27" lean-forward="false" selection-start-line="44" selection-start-column="27" selection-end-line="44" selection-end-column="27" /> <folding /> </state> </provider> </entry> + <entry file="file://$PROJECT_DIR$/src/main/java/org/s4s/process/control/LoginControl.java"> + <provider selected="true" editor-type-id="text-editor"> + <state relative-caret-position="270"> + <caret line="27" column="57" lean-forward="false" selection-start-line="24" selection-start-column="42" selection-end-line="27" selection-end-column="57" /> + <folding /> + </state> + </provider> + </entry> <entry file="file://$PROJECT_DIR$/src/main/java/org/s4s/dao/RegistrationDAO.java"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="242"> - <caret line="27" column="26" lean-forward="true" selection-start-line="27" selection-start-column="26" selection-end-line="27" selection-end-column="26" /> + <state relative-caret-position="449"> + <caret line="41" column="12" lean-forward="false" selection-start-line="41" selection-start-column="12" selection-end-line="43" selection-end-column="13" /> <folding> <marker date="1497910575000" expanded="true" signature="841:867" ph="INSERT INTO \"ERR\".... " /> <marker date="1497910575000" expanded="true" signature="841:916" ph="INSERT INTO \"ERR\".... " /> @@ -1619,24 +1625,16 @@ </state> </provider> </entry> - <entry file="file://$PROJECT_DIR$/src/main/java/org/s4s/process/control/LoginControl.java"> - <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="270"> - <caret line="27" column="57" lean-forward="false" selection-start-line="24" selection-start-column="42" selection-end-line="27" selection-end-column="57" /> - <folding /> - </state> - </provider> - </entry> <entry file="file://$PROJECT_DIR$/src/test/java/org/s4s/dao/impl/RegistrationControl_Test.java"> <provider selected="true" editor-type-id="text-editor"> - <state relative-caret-position="561"> - <caret line="53" column="112" lean-forward="false" selection-start-line="53" selection-start-column="112" selection-end-line="53" selection-end-column="112" /> + <state relative-caret-position="756"> + <caret line="66" column="59" lean-forward="false" selection-start-line="66" selection-start-column="59" selection-end-line="66" selection-end-column="59" /> <folding> - <marker date="1497912919000" expanded="true" signature="1443:1524" ph="SELECT * FRO... user" /> - <marker date="1497912919000" expanded="true" signature="1443:1525" ph="SELECT * FRO... user" /> - <marker date="1497912919000" expanded="true" signature="1443:1529" ph="SELECT * FRO... user" /> - <marker date="1497912919000" expanded="true" signature="1443:1530" ph="SELECT * FRO... user" /> - <marker date="1497912919000" expanded="true" signature="1564:1630" ph="SELECT * FRO... user" /> + <marker date="1497945181000" expanded="true" signature="1464:1545" ph="SELECT * FRO... user" /> + <marker date="1497945181000" expanded="true" signature="1464:1546" ph="SELECT * FRO... user" /> + <marker date="1497945181000" expanded="true" signature="1464:1550" ph="SELECT * FRO... user" /> + <marker date="1497945181000" expanded="true" signature="1464:1551" ph="SELECT * FRO... user" /> + <marker date="1497945181000" expanded="true" signature="1585:1651" ph="SELECT * FRO... user" /> </folding> </state> </provider> diff --git a/src/test/java/org/s4s/dao/impl/RegistrationControl_Test.java b/src/test/java/org/s4s/dao/impl/RegistrationControl_Test.java index 72091dd..8b0619f 100644 --- a/src/test/java/org/s4s/dao/impl/RegistrationControl_Test.java +++ b/src/test/java/org/s4s/dao/impl/RegistrationControl_Test.java @@ -6,6 +6,7 @@ import org.junit.After; import org.junit.Before; import org.junit.Test; import org.s4s.dao.RegistrationDAO; +import org.s4s.exceptions.WrongInputException; import org.s4s.modell.dto.User; import org.s4s.process.control.RegistrationControl; import org.s4s.services.db.JDBCConnection; @@ -50,25 +51,24 @@ public class RegistrationControl_Test { //unfinished @Test public void Registration_Test() { - User user1 = null; + String sql_query = "SELECT *" + " FROM \"ERR\".\"user\" u " + " WHERE u.benutzername = '" + "Testcase" +"';"; // String sql_query = "SELECT * FROM \"ERR\".\"user\" u WHERE u.benutzername = 'Testcase'"; try { ResultSet set = JDBCConnection.getInstance().getStatement().executeQuery(sql_query); - user1 = new User(set.getString("benutzername"), set.getInt("userID")); - user1.setVorname(set.getString("vorname")); - user1.setNachname(set.getString("nachname")); - user1.setFachbereichId(set.getInt("fachbereichid")); - user1.setEmail(set.getString("email")); - } catch (SQLException e) { + if(!set.next()){ + throw new WrongInputException("Wrong Input"); + } + assertEquals(user.getBenutzername(),set.getString("benutzername")); + assertEquals(user.getVorname(),set.getString("vorname")); + assertEquals(user.getNachname(),set.getString("nachname")); + assertEquals(user.getFachbereichId(),set.getInt("fachbreichid")); + assertEquals(user.getEmail(),set.getString("email")); + assertEquals(user.getUserId(),set.getInt("userID")); + } catch (Exception e) { e.printStackTrace(); } - assertEquals(user, user1); - - } - @After - public void delete(){ } -- GitLab