01: /*
02: * UtilsTest.java
03: * JUnit 4.x based test
04: *
05: * Created on October 15, 2007, 4:05 PM
06: */
07:
08: package org.netbeans.modules.sun.manager.jbi.util;
09:
10: import com.sun.jbi.ui.common.JBIComponentInfo;
11: import java.util.Map;
12: import javax.management.Attribute;
13: import javax.management.MBeanAttributeInfo;
14: import org.junit.After;
15: import org.junit.AfterClass;
16: import org.junit.Before;
17: import org.junit.BeforeClass;
18: import org.junit.Test;
19: import static org.junit.Assert.*;
20:
21: /**
22: *
23: * @author jqian
24: */
25: public class UtilsTest {
26:
27: public UtilsTest() {
28: }
29:
30: @BeforeClass
31: public static void setUpClass() throws Exception {
32: }
33:
34: @AfterClass
35: public static void tearDownClass() throws Exception {
36: }
37:
38: @Before
39: public void setUp() throws Exception {
40: }
41:
42: @After
43: public void tearDown() throws Exception {
44: }
45:
46: @Test
47: public void getIntrospectedPropertyMap() {
48: System.out.println("getIntrospectedPropertyMap");
49:
50: JBIComponentInfo bean = new JBIComponentInfo();
51: Map<Attribute, MBeanAttributeInfo> map = Utils
52: .getIntrospectedPropertyMap(bean, true,
53: "org.netbeans.modules.sun.manager.jbi.management.model.beaninfo");
54:
55: assertNotNull(map);
56: }
57:
58: @Test
59: public void wordWrapString() {
60: System.out.println("wordWrapString");
61:
62: int maxLineLength = 10;
63: String newLineChars = "&";
64:
65: String input = "[abc]";
66: String expResult = "[abc]&";
67: String result = Utils.wordWrapString(input, maxLineLength,
68: newLineChars);
69: assertEquals(expResult, result);
70:
71: input = "abc def ghi jkl mno pqr stu vwx yz";
72: expResult = "abc def &ghi jkl &mno pqr &stu vwx yz&";
73: result = Utils.wordWrapString(input, maxLineLength,
74: newLineChars);
75: assertEquals(expResult, result);
76:
77: input = "abcdefghijklmnopqrstuvwxyz";
78: expResult = "abcdefghij&klmnopqrst&uvwxyz&";
79: result = Utils.wordWrapString(input, maxLineLength,
80: newLineChars);
81: assertEquals(expResult, result);
82:
83: } /* Test of wordWrapString method, of class Utils. */
84:
85: }
|