0

I'm using Espresso to test my Android application. I try to type russian text to EditText using typeText(). And i get an exception

java.lang.NullPointerException: Failed to get events for string blabla...

Anybody, who knows the solution?

My logcat:

----- begin exception -----
02-19 17:42:32.634    2431-2448 I/TestRunner﹕ java.lang.NullPointerException: Failed to get events for string РОССИЯ
            at com.android.support.test.deps.guava.base.Preconditions.checkNotNull(Preconditions.java:208)
            at android.support.test.espresso.base.UiControllerImpl.injectString(UiControllerImpl.java:264)
            at android.support.test.espresso.action.TypeTextAction.perform(TypeTextAction.java:105)
            at android.support.test.espresso.ViewInteraction$1.run(ViewInteraction.java:144)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at android.os.Handler.handleCallback(Handler.java:733)
            at android.os.Handler.dispatchMessage(Handler.java:95)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5001)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
02-19 17:42:32.634    2431-2448 I/TestRunner﹕ ----- end exception -----
Slava Vedenin
  • 58,326
  • 13
  • 40
  • 59
kirik85
  • 1
  • 1
  • `Preconditions.checkNotNull`. ;-). – greenapps Feb 19 '15 at 14:50
  • Yeah :) I saw. But how can I type russian text in my view? Is there any other way? – kirik85 Feb 19 '15 at 14:53
  • Well you could better find out which pointer you use that is null. It's on line 208 of Preconditions.java. Post the relevant code and tell us which line is 208. – greenapps Feb 19 '15 at 14:59
  • Ok, I look at source code Espresso 2.0 and find injectString in UiControllerImpl.java. So, here is a code: KeyEvent[] events = keyCharacterMap.getEvents(str.toCharArray()); checkNotNull(events, "Failed to get events for string " + str); As I undestand Espresso can't find key code for russion letter. And how can I type russian text to edit text? – kirik85 Feb 19 '15 at 15:05
  • Please put code in a separate code blok. Not here in a comment as it is unreadable. Moreover what is null? Find out and tell. And post Preconditions.java:208. `I try to type russian text to EditText using typeText().`. If that is true then you are not typing but programmatically trying to place text. Please explain exactly what you do and post your code where you use typeText(). to begin with. Explain what is Espresso. – greenapps Feb 19 '15 at 15:25

0 Answers0