Avoid use of fragile Swing classes in tests (for compatibility with JDK 8u40)

Issue: SPR-12235
(cherry picked from commit a80495b)
This commit is contained in:
Juergen Hoeller
2014-09-26 21:40:09 +02:00
parent 50e50d0c18
commit f21c8c37fb

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2014 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,13 +16,12 @@
package org.springframework.beans;
import static org.junit.Assert.assertEquals;
import javax.swing.JPanel;
import javax.swing.JTextField;
import org.junit.Test;
import org.springframework.tests.sample.beans.TestBean;
import static org.junit.Assert.*;
/**
* Unit tests for {@link DirectFieldAccessor}
*
@@ -34,12 +33,13 @@ public class DirectFieldAccessorTests {
@Test
public void withShadowedField() throws Exception {
@SuppressWarnings("serial")
JPanel p = new JPanel() {
TestBean tb = new TestBean() {
@SuppressWarnings("unused")
JTextField name = new JTextField();
StringBuilder name = new StringBuilder();
};
DirectFieldAccessor dfa = new DirectFieldAccessor(p);
assertEquals(JTextField.class, dfa.getPropertyType("name"));
DirectFieldAccessor dfa = new DirectFieldAccessor(tb);
assertEquals(StringBuilder.class, dfa.getPropertyType("name"));
}
}