// Path: src/android-test/src/com/nikhaldimann/viewselector/android/testutil/AndroidTestViewFactory.java
// public class AndroidTestViewFactory extends ProvidedContextViewFactory {
// 
//     public AndroidTestViewFactory(Context context) {
//         super(context);
//     }
// 
// }
// 
// Path: src/main/java/com/nikhaldimann/viewselector/attributes/ViewAttributes.java
// public class ViewAttributes {
// 
//     private ViewAttributes() { }
// 
//     /**
//      * @return the full getter method name for a plain attribute, following conventions
//      *     used in the Android code. Prepends "get" to the attribute name and formats
//      *     it in camel-case. Recognizes boolean attributes of the format {@code isFoo} or
//      *     {@code hasFoo} and returns them unchanged.
//      */
//     public static String getGetterMethodName(String attributeName) {
//         if (isBooleanAttribute(attributeName, "is") || isBooleanAttribute(attributeName, "has")) {
//             return attributeName;
//         }
//         return "get" + attributeName.substring(0, 1).toUpperCase() + attributeName.substring(1);
//     }
// 
//     private static boolean isBooleanAttribute(String attributeName, String prefix) {
//         return attributeName.startsWith(prefix)
//                 && attributeName.length() > prefix.length()
//                 && Character.isUpperCase(attributeName.charAt(prefix.length()));
//     }
// 
//     /**
//      * Calls the given method by name on the given view, assuming that it's a getter,
//      * i.e., it doesn't have arguments.
//      * @return the result of the method call
//      * @throws AttributeAccessException when the method doesn't exist or can't be
//      *     called for various reasons
//      */
//     public static Object callGetter(View view, String methodName) {
//         try {
//             Method method = view.getClass().getMethod(methodName);
//             return method.invoke(view);
//         } catch (SecurityException ex) {
//             throw new AttributeAccessException(ex);
//         } catch (NoSuchMethodException ex) {
//             throw new AttributeAccessException("No such attribute", ex);
//         } catch (IllegalAccessException ex) {
//             throw new AttributeAccessException(ex);
//         } catch (InvocationTargetException ex) {
//             throw new AttributeAccessException(ex);
//         }
//     }
// 
//     /**
//      * Calls the given method by name on the given view, assuming that it's a getter,
//      * i.e., it doesn't have arguments.
//      *
//      * This method normalizes all instances of CharSequences to be instances of String.
//      * This is useful because Android is using some CharSequence representations
//      * internally that don't compare well with strings (in particular as returned
//      * from TextView.getText()).
//      *
//      * @return the result of the method call
//      * @throws AttributeAccessException when the method doesn't exist or can't be
//      *     called for various reasons
//      */
//     public static Object callGetterNormalizingStrings(View view, String methodName) {
//         Object value = callGetter(view, methodName);
//         if (value instanceof CharSequence) {
//             value = value.toString();
//         }
//         return value;
//     }
// 
// }
// 
// Path: src/test-lib/src/com/nikhaldimann/viewselector/test/abstrakt/attributes/AbstractViewAttributesTest.java
// public abstract class AbstractViewAttributesTest extends ViewSelectorAndroidTestCase {
// 
//     @Test
//     public void testGetGetterMethodName() {
//         assertEquals("getText", ViewAttributes.getGetterMethodName("text"));
//         assertEquals("getText", ViewAttributes.getGetterMethodName("Text"));
//         assertEquals("getFooText", ViewAttributes.getGetterMethodName("fooText"));
//     }
// 
//     @Test
//     public void testGetGetterMethodNameBooleanAttribute() {
//         assertEquals("isFoo", ViewAttributes.getGetterMethodName("isFoo"));
//         assertEquals("hasFoo", ViewAttributes.getGetterMethodName("hasFoo"));
//         assertEquals("getIs", ViewAttributes.getGetterMethodName("is"));
//         assertEquals("getIsland", ViewAttributes.getGetterMethodName("island"));
//         assertEquals("getHas", ViewAttributes.getGetterMethodName("has"));
//         assertEquals("getHash", ViewAttributes.getGetterMethodName("hash"));
//     }
// 
//     @Test
//     public void testCallGetter() {
//         TextView view = viewFactory.createTextView();
//         view.setText("foo");
//         view.setInputType(InputType.TYPE_CLASS_TEXT);
//         view.setVisibility(View.INVISIBLE);
//         assertEquals("foo", ViewAttributes.callGetter(view, "getText").toString());
//         assertEquals(null, ViewAttributes.callGetter(view, "getTag"));
//         assertEquals(InputType.TYPE_CLASS_TEXT, ViewAttributes.callGetter(view, "getInputType"));
//         assertEquals(false, ViewAttributes.callGetter(view, "isShown"));
//         // TODO need to figure out how to deal with base class methods in Robolectric
//     }
// 
//     @Test
//     public void testCallGetterNoSuchMethod() {
//         try {
//             ViewAttributes.callGetter(viewFactory.createTextView(), "getFoo");
//             fail();
//         } catch (AttributeAccessException ex) {
//             // expected
//         }
//     }
// 
// }
// 
// Path: src/test-lib/src/com/nikhaldimann/viewselector/test/util/ViewFactory.java
// public interface ViewFactory {
// 
//     TextView createTextView();
// 
//     LinearLayout createLinearLayout();
// 
//     FrameLayout createFrameLayout();
// 
// }


import android.widget.TextView;
import com.nikhaldimann.viewselector.android.testutil.AndroidTestViewFactory;
import com.nikhaldimann.viewselector.attributes.ViewAttributes;
import com.nikhaldimann.viewselector.test.abstrakt.attributes.AbstractViewAttributesTest;
import com.nikhaldimann.viewselector.test.util.ViewFactory;
package com.nikhaldimann.viewselector.android.attributes;



public class ViewAttributesTest extends AbstractViewAttributesTest {

    protected ViewFactory createViewFactory() {
        return new AndroidTestViewFactory(getContext());
    }

    public void testCallGettersOnBaseClass() {
        TextView view = viewFactory.createTextView();
        view.setMinimumHeight(200);
        view.setPivotX(1.25f);
// Path: src/android-test/src/com/nikhaldimann/viewselector/android/testutil/AndroidTestViewFactory.java
// public class AndroidTestViewFactory extends ProvidedContextViewFactory {
// 
//     public AndroidTestViewFactory(Context context) {
//         super(context);
//     }
// 
// }
// 
// Path: src/main/java/com/nikhaldimann/viewselector/attributes/ViewAttributes.java
// public class ViewAttributes {
// 
//     private ViewAttributes() { }
// 
//     /**
//      * @return the full getter method name for a plain attribute, following conventions
//      *     used in the Android code. Prepends "get" to the attribute name and formats
//      *     it in camel-case. Recognizes boolean attributes of the format {@code isFoo} or
//      *     {@code hasFoo} and returns them unchanged.
//      */
//     public static String getGetterMethodName(String attributeName) {
//         if (isBooleanAttribute(attributeName, "is") || isBooleanAttribute(attributeName, "has")) {
//             return attributeName;
//         }
//         return "get" + attributeName.substring(0, 1).toUpperCase() + attributeName.substring(1);
//     }
// 
//     private static boolean isBooleanAttribute(String attributeName, String prefix) {
//         return attributeName.startsWith(prefix)
//                 && attributeName.length() > prefix.length()
//                 && Character.isUpperCase(attributeName.charAt(prefix.length()));
//     }
// 
//     /**
//      * Calls the given method by name on the given view, assuming that it's a getter,
//      * i.e., it doesn't have arguments.
//      * @return the result of the method call
//      * @throws AttributeAccessException when the method doesn't exist or can't be
//      *     called for various reasons
//      */
//     public static Object callGetter(View view, String methodName) {
//         try {
//             Method method = view.getClass().getMethod(methodName);
//             return method.invoke(view);
//         } catch (SecurityException ex) {
//             throw new AttributeAccessException(ex);
//         } catch (NoSuchMethodException ex) {
//             throw new AttributeAccessException("No such attribute", ex);
//         } catch (IllegalAccessException ex) {
//             throw new AttributeAccessException(ex);
//         } catch (InvocationTargetException ex) {
//             throw new AttributeAccessException(ex);
//         }
//     }
// 
//     /**
//      * Calls the given method by name on the given view, assuming that it's a getter,
//      * i.e., it doesn't have arguments.
//      *
//      * This method normalizes all instances of CharSequences to be instances of String.
//      * This is useful because Android is using some CharSequence representations
//      * internally that don't compare well with strings (in particular as returned
//      * from TextView.getText()).
//      *
//      * @return the result of the method call
//      * @throws AttributeAccessException when the method doesn't exist or can't be
//      *     called for various reasons
//      */
//     public static Object callGetterNormalizingStrings(View view, String methodName) {
//         Object value = callGetter(view, methodName);
//         if (value instanceof CharSequence) {
//             value = value.toString();
//         }
//         return value;
//     }
// 
// }
// 
// Path: src/test-lib/src/com/nikhaldimann/viewselector/test/abstrakt/attributes/AbstractViewAttributesTest.java
// public abstract class AbstractViewAttributesTest extends ViewSelectorAndroidTestCase {
// 
//     @Test
//     public void testGetGetterMethodName() {
//         assertEquals("getText", ViewAttributes.getGetterMethodName("text"));
//         assertEquals("getText", ViewAttributes.getGetterMethodName("Text"));
//         assertEquals("getFooText", ViewAttributes.getGetterMethodName("fooText"));
//     }
// 
//     @Test
//     public void testGetGetterMethodNameBooleanAttribute() {
//         assertEquals("isFoo", ViewAttributes.getGetterMethodName("isFoo"));
//         assertEquals("hasFoo", ViewAttributes.getGetterMethodName("hasFoo"));
//         assertEquals("getIs", ViewAttributes.getGetterMethodName("is"));
//         assertEquals("getIsland", ViewAttributes.getGetterMethodName("island"));
//         assertEquals("getHas", ViewAttributes.getGetterMethodName("has"));
//         assertEquals("getHash", ViewAttributes.getGetterMethodName("hash"));
//     }
// 
//     @Test
//     public void testCallGetter() {
//         TextView view = viewFactory.createTextView();
//         view.setText("foo");
//         view.setInputType(InputType.TYPE_CLASS_TEXT);
//         view.setVisibility(View.INVISIBLE);
//         assertEquals("foo", ViewAttributes.callGetter(view, "getText").toString());
//         assertEquals(null, ViewAttributes.callGetter(view, "getTag"));
//         assertEquals(InputType.TYPE_CLASS_TEXT, ViewAttributes.callGetter(view, "getInputType"));
//         assertEquals(false, ViewAttributes.callGetter(view, "isShown"));
//         // TODO need to figure out how to deal with base class methods in Robolectric
//     }
// 
//     @Test
//     public void testCallGetterNoSuchMethod() {
//         try {
//             ViewAttributes.callGetter(viewFactory.createTextView(), "getFoo");
//             fail();
//         } catch (AttributeAccessException ex) {
//             // expected
//         }
//     }
// 
// }
// 
// Path: src/test-lib/src/com/nikhaldimann/viewselector/test/util/ViewFactory.java
// public interface ViewFactory {
// 
//     TextView createTextView();
// 
//     LinearLayout createLinearLayout();
// 
//     FrameLayout createFrameLayout();
// 
// }


// Path: src/android-test/src/com/nikhaldimann/viewselector/android/attributes/ViewAttributesTest.java
import android.widget.TextView;
import com.nikhaldimann.viewselector.android.testutil.AndroidTestViewFactory;
import com.nikhaldimann.viewselector.attributes.ViewAttributes;
import com.nikhaldimann.viewselector.test.abstrakt.attributes.AbstractViewAttributesTest;
import com.nikhaldimann.viewselector.test.util.ViewFactory;

package com.nikhaldimann.viewselector.android.attributes;



public class ViewAttributesTest extends AbstractViewAttributesTest {

    protected ViewFactory createViewFactory() {
        return new AndroidTestViewFactory(getContext());
    }

    public void testCallGettersOnBaseClass() {
        TextView view = viewFactory.createTextView();
        view.setMinimumHeight(200);
        view.setPivotX(1.25f);
        assertEquals(200, ViewAttributes.callGetter(view, "getMinimumHeight"));