From c1e4e89f9266d1d458ecf39365398dd1eafdef47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=AB=98=E9=93=81?= Date: Sun, 24 Apr 2016 12:01:23 +0800 Subject: [PATCH] fixed testcase --- .../java/com/alibaba/druid/bvt/bug/Bug_for_happyday517.java | 5 ++++- .../com/alibaba/druid/bvt/bug/Bug_for_happyday517_2.java | 5 ++++- .../com/alibaba/druid/bvt/bug/Bug_for_happyday517_3.java | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/test/java/com/alibaba/druid/bvt/bug/Bug_for_happyday517.java b/src/test/java/com/alibaba/druid/bvt/bug/Bug_for_happyday517.java index 299e757169..b26a98635c 100644 --- a/src/test/java/com/alibaba/druid/bvt/bug/Bug_for_happyday517.java +++ b/src/test/java/com/alibaba/druid/bvt/bug/Bug_for_happyday517.java @@ -32,8 +32,11 @@ public class Bug_for_happyday517 extends TestCase { private DruidDataSource dataSource; private MockDriver driver; + private int originalDataSourceCount = 0; protected void setUp() throws Exception { + originalDataSourceCount = DruidDataSourceStatManager.getInstance().getDataSourceList().size(); + driver = new MockDriver(); dataSource = new DruidDataSource(); dataSource.setUrl("jdbc:mock:xxx"); @@ -43,7 +46,7 @@ public class Bug_for_happyday517 extends TestCase { protected void tearDown() throws Exception { dataSource.close(); - Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size()); + Assert.assertEquals(originalDataSourceCount, DruidDataSourceStatManager.getInstance().getDataSourceList().size()); } public void test_for_happyday517_0() throws Exception { diff --git a/src/test/java/com/alibaba/druid/bvt/bug/Bug_for_happyday517_2.java b/src/test/java/com/alibaba/druid/bvt/bug/Bug_for_happyday517_2.java index 15791e3943..f8f2175a20 100644 --- a/src/test/java/com/alibaba/druid/bvt/bug/Bug_for_happyday517_2.java +++ b/src/test/java/com/alibaba/druid/bvt/bug/Bug_for_happyday517_2.java @@ -36,8 +36,11 @@ public class Bug_for_happyday517_2 extends TestCase { private MockDriver driver; final DataTruncation exception = new java.sql.DataTruncation(0, true, true, 0, 0); + + private int originalDataSourceCount = 0; protected void setUp() throws Exception { + originalDataSourceCount = DruidDataSourceStatManager.getInstance().getDataSourceList().size(); final MockPreparedStatement mockStatement = new MockPreparedStatement(null, null) { @@ -67,7 +70,7 @@ public class Bug_for_happyday517_2 extends TestCase { protected void tearDown() throws Exception { dataSource.close(); - Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size()); + Assert.assertEquals(originalDataSourceCount, DruidDataSourceStatManager.getInstance().getDataSourceList().size()); } public void test_bug() throws Exception { diff --git a/src/test/java/com/alibaba/druid/bvt/bug/Bug_for_happyday517_3.java b/src/test/java/com/alibaba/druid/bvt/bug/Bug_for_happyday517_3.java index d89ecf13c1..1198262497 100644 --- a/src/test/java/com/alibaba/druid/bvt/bug/Bug_for_happyday517_3.java +++ b/src/test/java/com/alibaba/druid/bvt/bug/Bug_for_happyday517_3.java @@ -29,7 +29,11 @@ public class Bug_for_happyday517_3 extends TestCase { private DruidDataSource dataSource; private MockDriver driver; + private int originalDataSourceCount = 0; + protected void setUp() throws Exception { + originalDataSourceCount = DruidDataSourceStatManager.getInstance().getDataSourceList().size(); + driver = new MockDriver(); dataSource = new DruidDataSource(); dataSource.setDriver(driver); @@ -40,7 +44,7 @@ public class Bug_for_happyday517_3 extends TestCase { protected void tearDown() throws Exception { dataSource.close(); - Assert.assertEquals(0, DruidDataSourceStatManager.getInstance().getDataSourceList().size()); + Assert.assertEquals(originalDataSourceCount, DruidDataSourceStatManager.getInstance().getDataSourceList().size()); } public void test_bug() throws Exception {