1 17 18 package org.apache.geronimo.common.propertyeditor; 19 20 import java.beans.PropertyEditor ; 21 import java.net.URL ; 22 23 import junit.framework.TestCase; 24 25 30 public class ArrayPropertyEditorAdapterTest 31 extends TestCase 32 { 33 PropertyEditor editor; 34 35 protected void setUp() 36 { 37 editor = PropertyEditors.findEditor(URL [].class); 38 } 39 40 public void testGetValue_Simple() 41 { 42 String input = "http://apache.org"; 43 44 editor.setAsText(input); 45 Object output = editor.getValue(); 46 47 assertNotNull(output); 48 assertEquals(URL [].class, output.getClass()); 49 50 URL [] urls = (URL [])output; 51 assertEquals(1, urls.length); 52 assertEquals(input, urls[0].toString()); 53 } 54 55 public void testGetValue_2URLs() 56 { 57 String input = "http://apache.org, http://google.com"; 58 59 editor.setAsText(input); 60 Object output = editor.getValue(); 61 62 assertNotNull(output); 63 assertEquals(URL [].class, output.getClass()); 64 65 URL [] urls = (URL [])output; 66 assertEquals(2, urls.length); 67 assertEquals("http://apache.org", urls[0].toString()); 68 assertEquals("http://google.com", urls[1].toString()); 69 } 70 } 71 | Popular Tags |