Can not test EditText for paswords

26 views
Skip to first unread message

Johannes Eickhold

unread,
Dec 8, 2011, 12:20:15 PM12/8/11
to Robolectric
Hi,

the class
com.xtremelabs.robolectric.shadows.ShadowPasswordTransformationMethod
does not return an instance of PasswordTransformationMethod when
calling getInstance(). This brakes the following assert

assertTrue( view.getTransformationMethod() instanceof
PasswordTransformationMethod );

which leads to:

java.lang.ClassCastException:
com.xtremelabs.robolectric.shadows.ShadowPasswordTransformationMethod
cannot be cast to android.text.method.PasswordTransformationMethod
at
android.text.method.PasswordTransformationMethod.getInstance(PasswordTransformationMethod.java)

I guess getInstance() should return a PasswordTransformationMethod and
not its shadow version.

Cheers,
Johannes.

Reply all
Reply to author
Forward
0 new messages