@@ -62,16 +62,14 @@ class LabelMatcher extends Matcher {
62
62
class IdMatcher extends Matcher {
63
63
constructor ( value ) {
64
64
super ( ) ;
65
- if ( typeof value !== 'string' ) throw new Error ( `IdMatcher ctor argument must be a string, got ${ typeof value } ` ) ;
66
- this . _call = invoke . call ( invoke . Android . Class ( DetoxMatcher ) , 'matcherForTestId' , value ) ;
65
+ this . _call = invoke . callDirectly ( DetoxMatcherApi . matcherForTestId ( value ) ) ;
67
66
}
68
67
}
69
68
70
69
class TypeMatcher extends Matcher {
71
70
constructor ( value ) {
72
71
super ( ) ;
73
- if ( typeof value !== 'string' ) throw new Error ( `TypeMatcher ctor argument must be a string, got ${ typeof value } ` ) ;
74
- this . _call = invoke . call ( invoke . Android . Class ( DetoxMatcher ) , 'matcherForClass' , value ) ;
72
+ this . _call = invoke . callDirectly ( DetoxMatcherApi . matcherForClass ( value ) ) ;
75
73
}
76
74
}
77
75
@@ -106,16 +104,14 @@ class NotExistsMatcher extends Matcher {
106
104
class TextMatcher extends Matcher {
107
105
constructor ( value ) {
108
106
super ( ) ;
109
- if ( typeof value !== 'string' ) throw new Error ( `TextMatcher ctor argument must be a string, got ${ typeof value } ` ) ;
110
- this . _call = invoke . call ( invoke . Android . Class ( DetoxMatcher ) , 'matcherForText' , value ) ;
107
+ this . _call = invoke . callDirectly ( DetoxMatcherApi . matcherForText ( value ) ) ;
111
108
}
112
109
}
113
110
114
111
class ValueMatcher extends Matcher {
115
112
constructor ( value ) {
116
113
super ( ) ;
117
- if ( typeof value !== 'string' ) throw new Error ( `ValueMatcher ctor argument must be a string, got ${ typeof value } ` ) ;
118
- this . _call = invoke . call ( invoke . Android . Class ( DetoxMatcher ) , 'matcherForContentDescription' , value ) ;
114
+ this . _call = invoke . callDirectly ( DetoxMatcherApi . matcherForContentDescription ( value ) ) ;
119
115
}
120
116
}
121
117
0 commit comments