diff options
author | Artur Signell <artur@vaadin.com> | 2016-01-02 14:48:55 +0200 |
---|---|---|
committer | Henri Sara <hesara@vaadin.com> | 2016-01-04 09:25:24 +0000 |
commit | 62a751d45415d66d13b51a3f11750ababe17a260 (patch) | |
tree | 8c74e949af554661256d4b20e1ef87a29260dcf8 /server/tests | |
parent | 82d009eb17da0b089535161833ab646566d8f2c5 (diff) | |
download | vaadin-framework-62a751d45415d66d13b51a3f11750ababe17a260.tar.gz vaadin-framework-62a751d45415d66d13b51a3f11750ababe17a260.zip |
Ensure no unknown attribute warnings are logged in design tests (#19429)
* Adds missing custom attributes to Slider/AbstractEmbedded
Change-Id: I574caf3499ab0681a7c829f89164062eb725013f
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/src/com/vaadin/tests/design/DeclarativeTestBaseBase.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/server/tests/src/com/vaadin/tests/design/DeclarativeTestBaseBase.java b/server/tests/src/com/vaadin/tests/design/DeclarativeTestBaseBase.java index e7bb8955cf..a7ff7174b2 100644 --- a/server/tests/src/com/vaadin/tests/design/DeclarativeTestBaseBase.java +++ b/server/tests/src/com/vaadin/tests/design/DeclarativeTestBaseBase.java @@ -23,6 +23,9 @@ import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.List; +import java.util.logging.Handler; +import java.util.logging.LogRecord; +import java.util.logging.Logger; import org.jsoup.Jsoup; import org.jsoup.nodes.Attribute; @@ -32,6 +35,7 @@ import org.jsoup.nodes.Node; import org.jsoup.nodes.TextNode; import org.junit.Assert; +import com.vaadin.ui.AbstractComponent; import com.vaadin.ui.Component; import com.vaadin.ui.declarative.Design; import com.vaadin.ui.declarative.DesignContext; @@ -149,14 +153,55 @@ public abstract class DeclarativeTestBaseBase<T extends Component> { } + public static class TestLogHandler { + final List<String> messages = new ArrayList<String>(); + Handler handler = new Handler() { + @Override + public void publish(LogRecord record) { + messages.add(record.getMessage()); + } + + @Override + public void flush() { + } + + @Override + public void close() throws SecurityException { + + } + }; + + public TestLogHandler() { + Logger.getLogger(AbstractComponent.class.getName()).getParent() + .addHandler(handler); + } + + public String getMessages() { + if (messages.isEmpty()) { + return ""; + } + + String r = ""; + for (String message : messages) { + r += message + "\n"; + } + return r; + } + + } + public T testRead(String design, T expected) { + TestLogHandler l = new TestLogHandler(); T read = read(design); assertEquals(expected, read); + Assert.assertEquals("", l.getMessages()); return read; } public void testWrite(String design, T expected) { + TestLogHandler l = new TestLogHandler(); testWrite(design, expected, false); + Assert.assertEquals("", l.getMessages()); } public void testWrite(String design, T expected, boolean writeData) { |