@@ -49,7 +49,7 @@ void run({required TestRunnerCallback testRunner}) {
4949 jint.type,
5050 [],
5151 );
52- expect (intValue, equals ( 176 ) );
52+ expect (intValue, 176 );
5353
5454 // Release any JObject and JClass instances using `.release()` after use.
5555 // This is not strictly required since JNI objects / classes have
@@ -70,7 +70,7 @@ void run({required TestRunnerCallback testRunner}) {
7070
7171 // Dart string is a copy, original object can be released.
7272 result.release ();
73- expect (resultString, equals ( "1f" ) );
73+ expect (resultString, "1f" );
7474
7575 // Also don't forget to release the class.
7676 integerClass.release ();
@@ -119,7 +119,7 @@ void run({required TestRunnerCallback testRunner}) {
119119 bits += r % 2 ;
120120 r = (r / 2 ).floor ();
121121 }
122- expect (jbc, equals ( bits) );
122+ expect (jbc, bits);
123123 }
124124 random.release ();
125125 longClass.release ();
@@ -132,25 +132,23 @@ void run({required TestRunnerCallback testRunner}) {
132132 jint.type,
133133 [JValueShort (1234 ), JValueShort (1324 )],
134134 );
135- expect (m, equals ( 1234 - 1324 ) );
135+ expect (m, 1234 - 1324 );
136136 shortClass.release ();
137137 });
138138
139139 testRunner ("Java char from string" , () {
140140 final characterClass = JCharacter .type.jClass;
141- final m = characterClass
142- .staticMethodId ("isLowerCase" , "(C)Z" )
143- .call (characterClass, const jcharType (), [JValueChar .fromString ('X' )]);
141+ final m = characterClass.staticMethodId ("isLowerCase" , "(C)Z" ).call (
142+ characterClass, const jbooleanType (), [JValueChar .fromString ('X' )]);
144143 expect (m, isFalse);
145144 characterClass.release ();
146145 });
147146
148147 testRunner ("Get static field" , () {
149148 final shortClass = JShort .type.jClass;
150- final maxLong = shortClass
151- .staticFieldId ("MAX_VALUE" , "S" )
152- .get (shortClass, const jshortType ());
153- expect (maxLong, equals (32767 ));
149+ final maxLong =
150+ shortClass.staticFieldId ("MAX_VALUE" , "S" ).get (shortClass, jshort.type);
151+ expect (maxLong, 32767 );
154152 shortClass.release ();
155153 });
156154
@@ -160,16 +158,16 @@ void run({required TestRunnerCallback testRunner}) {
160158 final strFromJava = longClass
161159 .staticMethodId ("toOctalString" , "(J)Ljava/lang/String;" )
162160 .call (longClass, JString .type, [n]);
163- expect (strFromJava, equals ( n.toRadixString (8 ) ));
161+ expect (strFromJava. toDartString (releaseOriginal : true ), n.toRadixString (8 ));
164162 longClass.release ();
165163 });
166164
167165 testRunner ("Passing strings in arguments" , () {
168166 final byteClass = JByte .type.jClass;
169167 final parseByte =
170168 byteClass.staticMethodId ("parseByte" , "(Ljava/lang/String;)B" );
171- final twelve = parseByte (byteClass, const jbyteType (), ["12" ]);
172- expect (twelve, equals ( 12 ) );
169+ final twelve = parseByte (byteClass, const jbyteType (), ["12" . toJString () ]);
170+ expect (twelve, 12 );
173171 byteClass.release ();
174172 });
175173
@@ -215,7 +213,7 @@ void run({required TestRunnerCallback testRunner}) {
215213 .instanceMethodId ("ordinal" , "()I" )
216214 .call (http, jint.type, []),
217215 );
218- expect (ordinal, equals ( 1 ) );
216+ expect (ordinal, 1 );
219217 proxyTypeClass.release ();
220218 });
221219
@@ -265,7 +263,7 @@ void run({required TestRunnerCallback testRunner}) {
265263 final integerClass = JInteger .type.jClass;
266264 return JClass .forName ("java/lang/Integer" )
267265 .staticMethodId ("parseInt" , "(Ljava/lang/String;)I" )
268- .call (integerClass, jint.type, ["X" ]);
266+ .call (integerClass, jint.type, ["X" . toJString () ]);
269267 },
270268 throwsA (isA <JniException >()),
271269 );
@@ -288,6 +286,6 @@ void run({required TestRunnerCallback testRunner}) {
288286 final longClass = JLong .type.jClass;
289287 final maxLong =
290288 longClass.staticFieldId ("MAX_VALUE" , "J" ).get (longClass, jlong.type);
291- expect (maxLong, equals ( maxLongInJava) );
289+ expect (maxLong, maxLongInJava);
292290 });
293291}
0 commit comments