package Ġorg . od k . collect . android shared . ui Ċ Ċ import Ġandroid . widget . EditText Ċ import Ġandroidx . test . platform . app . Instrumentation Registry Ċ import Ġorg . hamcrest . Core Matchers .` is ` Ċ import Ġorg . hamcrest . Matcher Assert . assertThat Ċ import Ġorg . junit . Before Ċ import Ġorg . junit . Test Ċ import Ġorg . junit . runner . RunWith Ċ import Ġorg . ro bo lectric . Ro bo lectric TestRunner Ċ Ċ @ RunWith ( Ro bo lectric TestRunner :: class ) Ċ class ĠOne Sign Text Watcher Test Ġ{ ĊĊĠĠĠ Ġlateinit Ġvar Ġone Sign Text Watcher : ĠOne Sign Text Watcher ĊĠĠĠ Ġlateinit Ġvar Ġedit Text : ĠEditText ĊĊĠĠĠ Ġ@ Before ĊĠĠĠ Ġfun Ġsetup () Ġ{ ĊĠĠĠĠĠĠĠ Ġedit Text Ġ= ĠEditText ( Instrumentation Registry . get Instrumentation (). target Context ) ĊĠĠĠĠĠĠĠ Ġone Sign Text Watcher Ġ= ĠOne Sign Text Watcher ( edit Text ) ĊĠĠĠĠĠĠĠ Ġedit Text . add TextChanged Listener ( one Sign Text Watcher ) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` One Ġcharacter Ġshould Ġbe Ġaccepted `() Ġ{ ĊĠĠĠĠĠĠĠ Ġedit Text . setText (" 1 ") ĊĠĠĠĠĠĠĠ ĠassertThat ( edit Text . text . toString (), Ġ` is ` (" 1 ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` Complex Ġemo jis Ġshould Ġbe Ġaccepted `() Ġ{ ĊĠĠĠĠĠĠĠ Ġedit Text . setText ("\ uD 8 3 C \ uD FF 4 \ u DB 4 0 \ u DC 6 7 \ u DB 4 0 \ u DC 6 2 \ u DB 4 0 \ u DC 6 5 \ u DB 4 0 \ u DC 6 E \ u DB 4 0 \ u DC 6 7 \ u DB 4 0 \ u DC 7 F ") ĊĠĠĠĠĠĠĠ ĠassertThat ( edit Text . text . toString (), Ġ` is ` ("\ uD 8 3 C \ uD FF 4 \ u DB 4 0 \ u DC 6 7 \ u DB 4 0 \ u DC 6 2 \ u DB 4 0 \ u DC 6 5 \ u DB 4 0 \ u DC 6 E \ u DB 4 0 \ u DC 6 7 \ u DB 4 0 \ u DC 7 F ")) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġ` Long er Ġstrings Ġshould Ġnot Ġbe Ġaccepted `() Ġ{ ĊĠĠĠĠĠĠĠ Ġedit Text . setText (" 1 2 ") ĊĠĠĠĠĠĠĠ ĠassertThat ( edit Text . text . toString (), Ġ` is ` ("")) ĊĠĠĠ Ġ} Ċ } Ċ