Skip to content

Commit f21c8c3

Browse files
committed
Avoid use of fragile Swing classes in tests (for compatibility with JDK 8u40)
Issue: SPR-12235 (cherry picked from commit a80495b)
1 parent 50e50d0 commit f21c8c3

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

spring-beans/src/test/java/org/springframework/beans/DirectFieldAccessorTests.java

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2011 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,12 +16,11 @@
1616

1717
package org.springframework.beans;
1818

19-
import static org.junit.Assert.assertEquals;
19+
import org.junit.Test;
2020

21-
import javax.swing.JPanel;
22-
import javax.swing.JTextField;
21+
import org.springframework.tests.sample.beans.TestBean;
2322

24-
import org.junit.Test;
23+
import static org.junit.Assert.*;
2524

2625
/**
2726
* Unit tests for {@link DirectFieldAccessor}
@@ -34,12 +33,13 @@ public class DirectFieldAccessorTests {
3433
@Test
3534
public void withShadowedField() throws Exception {
3635
@SuppressWarnings("serial")
37-
JPanel p = new JPanel() {
36+
TestBean tb = new TestBean() {
3837
@SuppressWarnings("unused")
39-
JTextField name = new JTextField();
38+
StringBuilder name = new StringBuilder();
4039
};
4140

42-
DirectFieldAccessor dfa = new DirectFieldAccessor(p);
43-
assertEquals(JTextField.class, dfa.getPropertyType("name"));
41+
DirectFieldAccessor dfa = new DirectFieldAccessor(tb);
42+
assertEquals(StringBuilder.class, dfa.getPropertyType("name"));
4443
}
44+
4545
}

0 commit comments

Comments
 (0)