package com.philemonworks.selfdiagnose.test;

import junit.framework.TestCase;

import com.philemonworks.selfdiagnose.DiagnoseException;
import com.philemonworks.selfdiagnose.ExecutionContext;
import com.philemonworks.selfdiagnose.check.CheckBeanProperty;

public class CheckBeanPropertyTest extends TestCase {
	public void testArrayListSize() throws DiagnoseException {
		CheckBeanProperty task = new CheckBeanProperty();
		task.setProperty("property");
		task.setBean("${bean}");
		task.setVariableName("var");

		ExecutionContext ctx = new ExecutionContext();
		ctx.setValue("bean", task);
		assertFalse(task.run(ctx).isError());
		assertEquals(ctx.getValue("var"),"property");

	}
	
	public void testStringProperty() throws DiagnoseException {
		CheckBeanProperty task = new CheckBeanProperty();
		task.setMethod("toUpperCase");
		task.setBean("Hello");
		task.setVariableName("var");

		ExecutionContext ctx = new ExecutionContext();
		assertFalse(task.run(ctx).isError());
		assertEquals(ctx.getValue("var"),"HELLO");

	}
}

@@ -313,17 +313,98 @@
 Case %7B%0D%0A
-%09
+%0D%0A    public static final String stopt() %7B%0D%0A        return %22HELLO%22;%0D%0A    %7D%0D%0A%0D%0A    
 public v
@@ -447,34 +447,40 @@
 oseException %7B%0D%0A
-%09%09
+        
 CheckBeanPropert
@@ -506,34 +506,40 @@
 eanProperty();%0D%0A
-%09%09
+        
 task.setProperty
@@ -549,26 +549,32 @@
 roperty%22);%0D%0A
-%09%09
+        
 task.setBean
@@ -583,26 +583,32 @@
 $%7Bbean%7D%22);%0D%0A
-%09%09
+        
 task.setVari
@@ -619,34 +619,40 @@
 Name(%22var%22);%0D%0A%0D%0A
-%09%09
+        
 ExecutionContext
@@ -683,18 +683,24 @@
 ext();%0D%0A
-%09%09
+        
 ctx.setV
@@ -716,26 +716,32 @@
 n%22, task);%0D%0A
-%09%09
+        
 assertFalse(
@@ -759,34 +759,40 @@
 x).isError());%0D%0A
-%09%09
+        
 assertEquals(ctx
@@ -808,16 +808,17 @@
 (%22var%22),
+ 
 %22propert
@@ -829,16 +829,21 @@
 %0D%0A%0D%0A
-%09
+    
 %7D%0D%0A
-%09
 %0D%0A
-%09
+    
 publ
@@ -899,18 +899,24 @@
 tion %7B%0D%0A
-%09%09
+        
 CheckBea
@@ -954,26 +954,32 @@
 roperty();%0D%0A
-%09%09
+        
 task.setMeth
@@ -994,26 +994,32 @@
 perCase%22);%0D%0A
-%09%09
+        
 task.setBean
@@ -1030,18 +1030,24 @@
 llo%22);%0D%0A
-%09%09
+        
 task.set
@@ -1070,18 +1070,24 @@
 r%22);%0D%0A%0D%0A
-%09%09
+        
 Executio
@@ -1122,26 +1122,32 @@
 Context();%0D%0A
-%09%09
+        
 assertFalse(
@@ -1177,10 +1177,16 @@
 );%0D%0A
-%09%09
+        
 asse
@@ -1214,16 +1214,17 @@
 (%22var%22),
+ 
 %22HELLO%22)
@@ -1232,9 +1232,449 @@
 %0D%0A%0D%0A
-%09
+    %7D%0D%0A%0D%0A    public void testCallStaticMethodProperty() throws DiagnoseException %7B%0D%0A        CheckBeanProperty task = new CheckBeanProperty();%0D%0A        task.setBean(%22$%7B@com.philemonworks.selfdiagnose.test.CheckBeanPropertyTest@stopt()%7D%22);%0D%0A        task.setVariableName(%22var%22);%0D%0A%0D%0A        ExecutionContext ctx = new ExecutionContext();%0D%0A        assertFalse(task.run(ctx).isError());%0D%0A        assertEquals(ctx.getValue(%22var%22), %22HELLO%22);%0D%0A%0D%0A    
 %7D%0D%0A%7D

add test (example) for calling a static method for checking a bean