From e69daa1270137d3dbeaf783c295ec32a3b0f099c Mon Sep 17 00:00:00 2001 From: Artur Signell Date: Fri, 30 Sep 2011 13:55:36 +0000 Subject: #7697 Corrected test so it won't affect other tests svn changeset:21478/svn branch:6.7 --- .../data/util/sqlcontainer/SQLContainerTest.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'tests/server-side/com/vaadin/data/util') diff --git a/tests/server-side/com/vaadin/data/util/sqlcontainer/SQLContainerTest.java b/tests/server-side/com/vaadin/data/util/sqlcontainer/SQLContainerTest.java index 6b3aed3203..56c9921a0b 100644 --- a/tests/server-side/com/vaadin/data/util/sqlcontainer/SQLContainerTest.java +++ b/tests/server-side/com/vaadin/data/util/sqlcontainer/SQLContainerTest.java @@ -818,10 +818,8 @@ public class SQLContainerTest { @Test public void containsId_unknownObject() throws SQLException { - SQLContainer container = new SQLContainer(new FreeformQuery( - "SELECT * FROM people", connectionPool, "ID")); - Logger logger = Logger.getLogger(SQLContainer.class.getName()); - logger.addHandler(new Handler() { + + Handler ensureNoLogging = new Handler() { @Override public void publish(LogRecord record) { @@ -836,9 +834,18 @@ public class SQLContainerTest { @Override public void close() throws SecurityException { } - }); + }; + + SQLContainer container = new SQLContainer(new FreeformQuery( + "SELECT * FROM people", connectionPool, "ID")); + Logger logger = Logger.getLogger(SQLContainer.class.getName()); - Assert.assertFalse(container.containsId(new Object())); + logger.addHandler(ensureNoLogging); + try { + Assert.assertFalse(container.containsId(new Object())); + } finally { + logger.removeHandler(ensureNoLogging); + } } @Test -- cgit v1.2.3