question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Want a tz resource jar for pure-java testing

See original GitHub issue

Unit testing pure java library classes without Robolectric causes “Resource not found” error (#17). It can be run without robolectric if jar file which contains only tz resource files is provided.

Example

build.gralde:

dependencies {
    compile 'net.danlew:android.joda:2.9.3'
    testCompile 'net.danlew:android.joda.tzdb:2.9.3'
}

Application class:

public void onCreate() {
    ...
    if (!isTesting) {
        JodaTimeAndroid.init()
    }
    ...
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
yprestocommented, Mar 30, 2016

Usually people just include the plain joda-time dependency for unit tests,

Perhaps I was misunderstanding, did you mean something like below?

dependencies {
    compile 'net.danlew:android.joda:2.9.3'
    testCompile 'joda-time:joda-time:2.9.3'
}

(There is similar question and solution on ThreeTenABP repo. https://github.com/JakeWharton/ThreeTenABP/issues/14#issuecomment-142049959 )

0reactions
yprestocommented, Mar 30, 2016

https://github.com/dlew/joda-time-android/issues/17#issuecomment-166010051 Omg there was same Q&A here… I’m sorry for duplicated issue 😭 Thanks for replies…!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Usage in unit testing · Issue #17 · dlew/joda-time-android
When unit testing the Android app (junit.framework.TestCase or Junit 4 tests from a ... Want a tz resource jar for pure-java testing #127....
Read more >
Timezone Updater Tool - Oracle
Obtain the currently installed timezone data version from the command java -jar tzupdater.jar -V . Rename the current 'tzdb.dat' file to something like...
Read more >
Reading Test resources from jar file in java - Stack Overflow
I have one project A which has some test ...
Read more >
How to create a jar containing test classes - Apache Maven
Create a separate project with the test-classes. The easy way. You can produce a jar which will include your test classes and resources....
Read more >
Java Security and z/OS - The Complete View - IBM Redbooks
JAR files can contain the source code of the Java application, compiled classes, and any number of other resources. JAR files are compressed ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found