From 48b8d0377ca8055319b00974dc777996790f6661 Mon Sep 17 00:00:00 2001 From: DmitriyMX Date: Sat, 6 Oct 2018 17:07:34 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=82=D0=B5=D1=81=D1=82=D0=B0=20DAO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/test/java/mc/core/h2db/TestDAO.java | 34 ++++++------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/h2_playermanager/src/test/java/mc/core/h2db/TestDAO.java b/h2_playermanager/src/test/java/mc/core/h2db/TestDAO.java index 4c9c094..9abc262 100644 --- a/h2_playermanager/src/test/java/mc/core/h2db/TestDAO.java +++ b/h2_playermanager/src/test/java/mc/core/h2db/TestDAO.java @@ -85,8 +85,6 @@ public class TestDAO { @Test(expected = DuplicateKeyException.class) public void testInsertDuplicateKey() throws SQLException { playerDAO.insert(player); - assertNotEquals(0, player.getId()); - playerDAO.insert(player); } @@ -133,6 +131,17 @@ public class TestDAO { assertEquals(player, queryPlayer); } + @Test + public void testGetByNonExistsName() throws SQLException { + playerDAO.insert(this.player); + + H2Player player = new H2Player(); + player.setName("NON_EXISTS_NAME"); + + boolean result = playerDAO.getByName(player); + assertFalse(result); + } + @Test public void testGetById() throws SQLException { playerDAO.insert(this.player); @@ -146,17 +155,6 @@ public class TestDAO { assertEquals(player, queryPlayer); } - @Test - public void testGetByNonExistsName() throws SQLException { - playerDAO.insert(this.player); - - H2Player player = new H2Player(); - player.setName("NON_EXISTS_NAME"); - - boolean result = playerDAO.getByName(player); - assertFalse(result); - } - @Test public void testGetByNonExistsId() throws SQLException { playerDAO.insert(player); @@ -172,7 +170,6 @@ public class TestDAO { @Test public void testUpdate() throws SQLException { playerDAO.insert(player); - assertNotEquals(0, player.getId()); player.setName("UNKNOWN_PLAYER"); playerDAO.update(player); @@ -183,7 +180,6 @@ public class TestDAO { @Test(expected = SQLException.class) public void testUpdateEmptyName() throws SQLException { playerDAO.insert(player); - assertNotEquals(0, player.getId()); player.setName(""); playerDAO.update(player); @@ -192,7 +188,6 @@ public class TestDAO { @Test(expected = SQLException.class) public void testUpdateNullName() throws SQLException { playerDAO.insert(player); - assertNotEquals(0, player.getId()); player.setName(null); playerDAO.update(player); @@ -201,7 +196,6 @@ public class TestDAO { @Test(expected = SQLException.class) public void testUpdateNullUuid() throws SQLException { playerDAO.insert(player); - assertNotEquals(0, player.getId()); player.setUuid(null); playerDAO.update(player); @@ -210,7 +204,6 @@ public class TestDAO { @Test(expected = SQLException.class) public void testUpdateNullLocation() throws SQLException { playerDAO.insert(player); - assertNotEquals(0, player.getId()); player.setLocation(null); playerDAO.update(player); @@ -219,7 +212,6 @@ public class TestDAO { @Test(expected = SQLException.class) public void testUpdateNullWorld() throws SQLException { playerDAO.insert(player); - assertNotEquals(0, player.getId()); player.setWorld(null); playerDAO.update(player); @@ -228,7 +220,6 @@ public class TestDAO { @Test public void testUpdateLocation() throws SQLException { playerDAO.insert(player); - assertNotEquals(0, player.getId()); final String origName = player.getName(); player.setName("UNKNOWN_PLAYER"); @@ -254,7 +245,6 @@ public class TestDAO { @Test(expected = SQLException.class) public void testUpdateLocationNull() throws SQLException { playerDAO.insert(player); - assertNotEquals(0, player.getId()); player.setLocation(null); playerDAO.updateLocation(player); @@ -263,7 +253,6 @@ public class TestDAO { @Test public void testRemove() throws SQLException { playerDAO.insert(player); - assertNotEquals(0, player.getId()); final int origId = player.getId(); playerDAO.remove(player); @@ -278,7 +267,6 @@ public class TestDAO { @Test(expected = SQLException.class) public void testRemoveNonExistsId() throws SQLException { playerDAO.insert(player); - assertNotEquals(0, player.getId()); player.setId(999); playerDAO.remove(player);