@Test
 public void testHasProperty() throws Exception {
   Bean instance = new Bean(C1.class);
   assertTrue(instance.hasProperty("string1"));
   assertTrue(instance.hasProperty("string2"));
   assertTrue(instance.hasProperty("integer1"));
   assertTrue(instance.hasProperty("integer2"));
 }
 @Test
 public void testSetProperty_field() throws Exception {
   C1 object = new C1();
   String propertyName = "string2";
   Object value = "myStringValue";
   Bean instance = new Bean(C1.class);
   instance.setProperty(object, propertyName, value);
   assertEquals(value, object.string2);
 }
 @Test
 public void testInvoke_4args_noFiltred() throws Exception {
   Collection expResult = new HashSet();
   C2 object = new C2();
   Bean instance = new Bean(C2.class);
   ClassFilter filter = new SimpleClassFilter(C1.class, MethodAnn.class);
   Object result = instance.invoke(object, "myText", new Object[] {}, filter);
   assertEquals(expResult, result);
 }
 @Test
 public void testInvoke_4args_correct() throws Exception {
   Collection expResult = new HashSet();
   expResult.add("myTextResult");
   C2 object = new C2();
   Bean instance = new Bean(C2.class);
   Object result = instance.invoke(object, "myText", new Object[] {}, new SimpleClassFilter());
   assertEquals(expResult, result);
 }
 @Test
 public void testGetProperty_field() throws Exception {
   C1 object = new C1();
   String propertyName = "string2";
   String value = "myStringValue";
   object.string2 = value;
   Bean instance = new Bean(C1.class);
   Object result = instance.getProperty(object, propertyName);
   assertEquals(value, result);
 }
 @Test
 public void testSetProperty_4args_correctSet() throws Exception {
   C1 object = new C1();
   String propertyName = "string1";
   Object value = "myStringValue";
   Bean instance = new Bean(C1.class);
   ClassFilter filter = new SimpleClassFilter();
   instance.setProperty(object, propertyName, value, filter);
   assertNotNull(object.getString1());
 }
 @Test
 public void testGetProperty_string1() throws Exception {
   System.out.println("getProperty");
   C1 object = new C1();
   String propertyName = "string1";
   Bean instance = new Bean(C1.class);
   String expResult = "myExpResult";
   object.setString1(expResult);
   Object result = instance.getProperty(object, propertyName);
   assertEquals(expResult, result);
 }
 @Test
 public void testGetProperty_3args_correct() throws Exception {
   C1 object = new C1();
   String propertyName = "string1";
   ClassFilter filter = new SimpleClassFilter();
   Bean instance = new Bean(C1.class);
   String expResult = "mystring";
   object.setString1(expResult);
   Object result = instance.getProperty(object, propertyName, filter);
   assertEquals(expResult, result);
 }
 @Test
 public void testGetProperties() throws Exception {
   Bean instance = new Bean(C1.class);
   Collection expResult = new HashSet();
   expResult.add("string1");
   expResult.add("string2");
   expResult.add("string3");
   expResult.add("integer1");
   expResult.add("integer2");
   Collection result = instance.getProperties();
   assertEquals(expResult, result);
 }
 @Test
 public void testSetProperty_4args_deniedByFilter() throws Exception {
   C1 object = new C1();
   object.setString1(null);
   String propertyName = "string1";
   Object value = "myStringValue";
   Bean instance = new Bean(C1.class);
   ClassFilter filter = new SimpleClassFilter(C3.class, TypeAnn.class);
   try {
     instance.setProperty(object, propertyName, value, filter);
   } catch (IllegalAccessException ex) {
     if (ex.getMessage().equals("Property no found")) {
       // IS OK - it is correct
       return;
     }
   }
   // Error
   throw new Exception("No correct - Inncorect result");
 }
 void validateDataFrameWithBeans(Bean bean, DataFrame df) {
   StructType schema = df.schema();
   Assert.assertEquals(
       new StructField("a", DoubleType$.MODULE$, false, Metadata.empty()), schema.apply("a"));
   Assert.assertEquals(
       new StructField("b", new ArrayType(IntegerType$.MODULE$, true), true, Metadata.empty()),
       schema.apply("b"));
   ArrayType valueType = new ArrayType(DataTypes.IntegerType, false);
   MapType mapType = new MapType(DataTypes.StringType, valueType, true);
   Assert.assertEquals(new StructField("c", mapType, true, Metadata.empty()), schema.apply("c"));
   Assert.assertEquals(
       new StructField("d", new ArrayType(DataTypes.StringType, true), true, Metadata.empty()),
       schema.apply("d"));
   Row first = df.select("a", "b", "c", "d").first();
   Assert.assertEquals(bean.getA(), first.getDouble(0), 0.0);
   // Now Java lists and maps are converted to Scala Seq's and Map's. Once we get a Seq below,
   // verify that it has the expected length, and contains expected elements.
   Seq<Integer> result = first.getAs(1);
   Assert.assertEquals(bean.getB().length, result.length());
   for (int i = 0; i < result.length(); i++) {
     Assert.assertEquals(bean.getB()[i], result.apply(i));
   }
   @SuppressWarnings("unchecked")
   Seq<Integer> outputBuffer = (Seq<Integer>) first.getJavaMap(2).get("hello");
   Assert.assertArrayEquals(
       bean.getC().get("hello"),
       Ints.toArray(JavaConverters.seqAsJavaListConverter(outputBuffer).asJava()));
   Seq<String> d = first.getAs(3);
   Assert.assertEquals(bean.getD().size(), d.length());
   for (int i = 0; i < d.length(); i++) {
     Assert.assertEquals(bean.getD().get(i), d.apply(i));
   }
 }
 @Test
 public void testGetBaseClass() throws Exception {
   Bean instance = new Bean(C1.class);
   Class result = instance.getBaseClass();
   assertEquals(C1.class, result);
 }