I’m writing testing library with my own junit runner. it extends BlockJUnit4ClassRunner which is available since 4.5 till… who knows. user of my library should be able to choose whatever junit version (with BlockJUnit4ClassRunner of course). and i don’t know how to define dependency on junit (let’s say current version is 4.10).
- if i make [4.5, 4.10] provided, then i have to release new version with every junit release
- i’m not sure if [4.5, ) is good a good practise because it implicitly chooses the newest version and build may not be repeatable
e.g. mockito uses ant and junit 4.10 only for compilation and have no maven dependency on it. i also don’t know if it’s a good practice.
how should i solve this dependency problem
In general, JUnit releases are backward compatible[*]. The developers take great care so that they are backward compatible. One option would be to declare a dependency on JUnit 4.5, and then the user can override that version in their pom (with version 4.10), and it should still work.
If you’re doing the above and claiming that it works with all versions after 4.5, then you should be testing with all versions as well, which should be reasonably easy to do.
[*] Classes and methods are deprecated of course, but things should still work.