Good! But please, back any action with an Issue - what would have you done if you would had been a contributor rather than a committer, to add missing tests?
Thanks, -Simo http://people.apache.org/~simonetripodi/ http://simonetripodi.livejournal.com/ http://twitter.com/simonetripodi http://www.99soft.org/ On Sat, Feb 16, 2013 at 1:43 PM, <brit...@apache.org> wrote: > Author: britter > Date: Sat Feb 16 12:43:14 2013 > New Revision: 1446886 > > URL: http://svn.apache.org/r1446886 > Log: > Add test case for BeanAccessor.cast() > > Added: > > commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/CastTestCase.java > (with props) > > Added: > commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/CastTestCase.java > URL: > http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/CastTestCase.java?rev=1446886&view=auto > ============================================================================== > --- > commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/CastTestCase.java > (added) > +++ > commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/CastTestCase.java > Sat Feb 16 12:43:14 2013 > @@ -0,0 +1,75 @@ > +package org.apache.commons.beanutils2; > + > +/* > + * Licensed to the Apache Software Foundation (ASF) under one or more > + * contributor license agreements. See the NOTICE file distributed with > + * this work for additional information regarding copyright ownership. > + * The ASF licenses this file to You under the Apache License, Version 2.0 > + * (the "License"); you may not use this file except in compliance with > + * the License. You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + * See the License for the specific language governing permissions and > + * limitations under the License. > + */ > + > +import static org.apache.commons.beanutils2.BeanUtils.on; > +import static org.junit.Assert.assertNotNull; > +import static org.junit.Assert.assertSame; > + > +import org.junit.Before; > +import org.junit.Test; > + > +public class CastTestCase > +{ > + > + private SuperClass superObj; > + > + private SubClass subObj; > + > + @Before > + public void setUp() > + { > + superObj = new SuperClass(); > + subObj = new SubClass(); > + } > + > + @Test > + public void castSameClass() > + { > + SuperClass casted = on( superObj ).cast(); > + assertNotNull( casted ); > + assertSame( superObj, casted ); > + } > + > + @Test > + public void castCompatible() > + { > + SuperClass casted = on( subObj ).cast(); > + assertNotNull( casted ); > + assertSame( subObj, casted ); > + } > + > + @Test( expected = ClassCastException.class ) > + public void castIncompatible() > + { > + @SuppressWarnings( "unused" ) // need to assign to casted to force > exception > + SubClass casted = on( superObj ).cast(); > + } > + > + private static class SuperClass > + { > + > + } > + > + private static class SubClass > + extends SuperClass > + { > + > + } > + > +} > > Propchange: > commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/CastTestCase.java > ------------------------------------------------------------------------------ > svn:eol-style = native > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org