1 15 package org.apache.hivemind.management.impl; 16 17 import javax.management.ObjectName ; 18 19 import junit.framework.TestCase; 20 21 26 public class TestObjectNameEditor extends TestCase 27 { 28 public void testSetAsText() 29 { 30 ObjectNameEditor editor = new ObjectNameEditor(); 31 editor.setAsText("Hivemind:name=test"); 32 ObjectName objectName = (ObjectName ) editor.getValue(); 33 34 assertEquals("Hivemind:name=test", objectName.toString()); 35 } 36 37 public void testMalformed() 38 { 39 ObjectNameEditor editor = new ObjectNameEditor(); 40 try 41 { 42 editor.setAsText("Hivemind=test:fail"); 43 fail(); 44 } 45 catch (IllegalArgumentException ignore) 46 { 47 } 48 } 49 50 public void testGetAsText() throws Exception 51 { 52 ObjectNameEditor editor = new ObjectNameEditor(); 53 editor.setValue(new ObjectName ("Hivemind:name=test")); 54 55 assertEquals("Hivemind:name=test", editor.getAsText()); 56 } 57 } 58 | Popular Tags |