~james-page/ubuntu/natty/tomcat6/fix-662588

« back to all changes in this revision

Viewing changes to test/org/apache/el/lang/TestELSupport.java

  • Committer: Bazaar Package Importer
  • Author(s): Thierry Carrez
  • Date: 2010-05-21 13:51:15 UTC
  • mfrom: (2.2.12 sid)
  • Revision ID: james.westby@ubuntu.com-20100521135115-qfwnf24lzvi3644v
Tags: 6.0.26-2
* debian/tomcat6.{postinst,prerm}: Respect TOMCAT6_USER and TOMCAT6_GROUP
  as defined in /etc/default/tomcat6 when setting directory permissions and
  authbind configuration (Closes: #581018, LP: #557300)
* debian/tomcat6.postinst: Use group "tomcat6" instead of "adm" for
  permissions in /var/lib/tomcat6, so that group "adm" doesn't get write
  permissions over /var/lib/tomcat6/webapps (LP: #569118)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import java.math.BigDecimal;
20
20
import java.math.BigInteger;
21
21
 
 
22
import javax.el.ELException;
 
23
 
22
24
import junit.framework.TestCase;
23
25
 
24
26
public class TestELSupport extends TestCase {
66
68
        Object output = ELSupport.coerceToType(null, Number.class);
67
69
        assertEquals(Long.valueOf(0), output);
68
70
    }
 
71
    
 
72
    public void testCoerceEnumAToEnumA() {
 
73
        Object output = null;
 
74
        try {
 
75
            output = ELSupport.coerceToEnum(TestEnumA.VALA1, TestEnumA.class);
 
76
        } finally {
 
77
            assertEquals(TestEnumA.VALA1, output);
 
78
        }
 
79
    }
 
80
    
 
81
    public void testCoerceEnumAToEnumB() {
 
82
        Object output = null;
 
83
        try {
 
84
            output = ELSupport.coerceToEnum(TestEnumA.VALA1, TestEnumB.class);
 
85
        } catch (ELException ele) {
 
86
            // Ignore
 
87
        }
 
88
        assertNull(output);
 
89
    }
 
90
 
 
91
    public void testCoerceEnumAToEnumC() {
 
92
        Object output = null;
 
93
        try {
 
94
            output = ELSupport.coerceToEnum(TestEnumA.VALA1, TestEnumC.class);
 
95
        } catch (ELException ele) {
 
96
            // Ignore
 
97
        }
 
98
        assertNull(output);
 
99
    }
69
100
 
70
101
    private static void testIsSame(Object value) {
71
102
        assertEquals(value, ELSupport.coerceToNumber(value, value.getClass()));
72
103
    }
 
104
    
 
105
    private static enum TestEnumA {
 
106
        VALA1,
 
107
        VALA2
 
108
    }
 
109
    private static enum TestEnumB {
 
110
        VALB1,
 
111
        VALB2
 
112
    }
 
113
    private static enum TestEnumC {
 
114
        VALA1,
 
115
        VALA2,
 
116
        VALB1,
 
117
        VALB2
 
118
    }
73
119
}