Author: britter
Date: Sat Feb 16 11:26:20 2013
New Revision: 1446874

URL: http://svn.apache.org/r1446874
Log:
Add tests for BeanProperties.hasProperty(String)

Added:
    
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/HasPropertyTestCase.java
   (with props)

Added: 
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/HasPropertyTestCase.java
URL: 
http://svn.apache.org/viewvc/commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/HasPropertyTestCase.java?rev=1446874&view=auto
==============================================================================
--- 
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/HasPropertyTestCase.java
 (added)
+++ 
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/HasPropertyTestCase.java
 Sat Feb 16 11:26:20 2013
@@ -0,0 +1,53 @@
+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.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.commons.beanutils2.testbeans.TestBean;
+import org.junit.Test;
+
+public class HasPropertyTestCase
+{
+
+    @Test( expected = NullPointerException.class )
+    public void hasPropertyNull()
+        throws Exception
+    {
+        on( TestBean.class ).getProperties().hasProperty( null );
+    }
+
+    @Test
+    public void hasPropertyUnknown()
+        throws Exception
+    {
+        boolean shouldBeFalse = on( TestBean.class 
).getProperties().hasProperty( "unknown" );
+        assertFalse( shouldBeFalse );
+    }
+
+    @Test
+    public void hasPropertyExistingProperty()
+        throws Exception
+    {
+        boolean shouldBeTrue = on( TestBean.class 
).getProperties().hasProperty( "stringProperty" );
+        assertTrue( shouldBeTrue );
+    }
+
+}

Propchange: 
commons/sandbox/beanutils2/trunk/src/test/java/org/apache/commons/beanutils2/HasPropertyTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native


Reply via email to