You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Much of what Paraphrase generates is testable on the JVM: androidx.collection.ArrayMap has a default implementation that is available on the JVM; generated code populates this map and returns. Most Android-specific code is part of the runtime, which can be replaced with fakes for JVM tests.
But for date/time arguments, Paraphrase generates code that uses classes from the android.icu.util package: Calendar, TimeZone, and ULocale. These classes have no default implementations, and thus fail on the JVM unless something like Robolectric is used. Further, even if Robolectric is used, these classes clash with JVM-friendly fake runtimes that use com.ibm.icu.text.MessageFormat, since the ICU package is different.
Possible fixes for this:
Write all Android-specific code in the runtime. In the case of date/time args, this would imply creating some interface for generated code to interact with, which could be (statically? 😬) replaced with a fake.
Dynamically resolve either android.icu or com.ibm.icu package in generated code based on some signal, like the presence of JUnit.
The text was updated successfully, but these errors were encountered:
Much of what Paraphrase generates is testable on the JVM:
androidx.collection.ArrayMap
has a default implementation that is available on the JVM; generated code populates this map and returns. Most Android-specific code is part of the runtime, which can be replaced with fakes for JVM tests.But for date/time arguments, Paraphrase generates code that uses classes from the
android.icu.util
package:Calendar
,TimeZone
, andULocale
. These classes have no default implementations, and thus fail on the JVM unless something like Robolectric is used. Further, even if Robolectric is used, these classes clash with JVM-friendly fake runtimes that usecom.ibm.icu.text.MessageFormat
, since the ICU package is different.Possible fixes for this:
android.icu
orcom.ibm.icu
package in generated code based on some signal, like the presence of JUnit.The text was updated successfully, but these errors were encountered: