From 74b5487a2859274d1836b3cd0322597cec32a1db Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 15 Dec 2011 23:47:45 +0100 Subject: [PATCH] IntelliJ IDEA 11 project setup --- .../test/util/ReflectionTestUtilsTests.java | 62 + spring-framework.ipr | 2199 +++++++++-------- 2 files changed, 1270 insertions(+), 991 deletions(-) diff --git a/org.springframework.test/src/test/java/org/springframework/test/util/ReflectionTestUtilsTests.java b/org.springframework.test/src/test/java/org/springframework/test/util/ReflectionTestUtilsTests.java index 41b98ce8df..02c41e7d80 100644 --- a/org.springframework.test/src/test/java/org/springframework/test/util/ReflectionTestUtilsTests.java +++ b/org.springframework.test/src/test/java/org/springframework/test/util/ReflectionTestUtilsTests.java @@ -191,4 +191,66 @@ public class ReflectionTestUtilsTests extends TestCase { }.runTest(); } + @Test + public void invokeMethodWithAutoboxingAndUnboxing() { + // IntelliJ IDEA 11 won't accept int assignment here + Integer difference = invokeMethod(component, "subtract", 5, 2); + assertEquals("subtract(5, 2)", 3, difference.intValue()); + } + + @Ignore("[SPR-8644] findMethod() does not currently support var-args") + @Test + public void invokeMethodWithPrimitiveVarArgs() { + // IntelliJ IDEA 11 won't accept int assignment here + Integer sum = invokeMethod(component, "add", 1, 2, 3, 4); + assertEquals("add(1,2,3,4)", 10, sum.intValue()); + } + + @Test + public void invokeMethodWithPrimitiveVarArgsAsSingleArgument() { + // IntelliJ IDEA 11 won't accept int assignment here + Integer sum = invokeMethod(component, "add", new int[] { 1, 2, 3, 4 }); + assertEquals("add(1,2,3,4)", 10, sum.intValue()); + } + + @Test + public void invokeMethodsSimulatingLifecycleEvents() { + assertNull("number", component.getNumber()); + assertNull("text", component.getText()); + + // Simulate autowiring a configuration method + invokeMethod(component, "configure", new Integer(42), "enigma"); + assertEquals("number should have been configured", new Integer(42), component.getNumber()); + assertEquals("text should have been configured", "enigma", component.getText()); + + // Simulate @PostConstruct life-cycle event + invokeMethod(component, "init"); + // assertions in init() should succeed + + // Simulate @PreDestroy life-cycle event + invokeMethod(component, "destroy"); + assertNull("number", component.getNumber()); + assertNull("text", component.getText()); + } + + @Test(expected = IllegalStateException.class) + public void invokeMethodWithIncompatibleArgumentTypes() { + invokeMethod(component, "subtract", "foo", 2.0); + } + + @Test(expected = IllegalStateException.class) + public void invokeInitMethodBeforeAutowiring() { + invokeMethod(component, "init"); + } + + @Test(expected = IllegalStateException.class) + public void invokeMethodWithTooFewArguments() { + invokeMethod(component, "configure", new Integer(42)); + } + + @Test(expected = IllegalStateException.class) + public void invokeMethodWithTooManyArguments() { + invokeMethod(component, "configure", new Integer(42), "enigma", "baz", "quux"); + } + } diff --git a/spring-framework.ipr b/spring-framework.ipr index 7eeaabcb01..afc4643b98 100644 --- a/spring-framework.ipr +++ b/spring-framework.ipr @@ -1,991 +1,1208 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://www.w3.org/1999/xhtml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://www.w3.org/1999/xhtml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +