Comments (22)
We are now at java 15 going on 16 and Java 7 is now very much end-of-life. Isn't it time to include optionals into the standard java hamcrest library?
from javahamcrest.
Hi all. We at Spotify have open-sourced some matchers for Optionals here https://github.com/spotify/java-hamcrest. Hopefully you find these useful and maybe we can even get some of these into upstream.
Let us know if you have questions or ideas.
from javahamcrest.
@cod3hulk @matteprl @scheffield
I have released hamcrest-optional to maven central
<dependency>
<groupId>com.github.npathai</groupId>
<artifactId>hamcrest-optional</artifactId>
<version>1.0</version>
</dependency>
from javahamcrest.
You can have support for Java 8 types but keep compatibility with former version if you just use a JDK 8 to compile the code with e.g. 1.6 target. If the code using the newly introduced types is in dedicated classes, this doesn't cause any issues. Spring Framework makes heavy use of this technique.
from javahamcrest.
+1
from javahamcrest.
👍
from javahamcrest.
Yes, but not in core, because we support old versions of the Java language that is still used in embedded systems. Matchers for Java 8 classes will have to go in their own add-on library for now.
from javahamcrest.
👍
from javahamcrest.
I have some String related utilities that I have created for my personal use. I would love to contribute those. Have we decided the way we have to package those classes? Will it be an extra library for 1.8 as well?
from javahamcrest.
I suggest publishing them as an extension library to start with.
On Wednesday, 1 July 2015, Narendra Pathai [email protected] wrote:
I have some String related utilities that I have created for my personal
use. I would love to contribute those. Have we decided the way we have to
package those classes? Will it be an extra library for 1.8 as well?—
Reply to this email directly or view it on GitHub
#82 (comment)
.
from javahamcrest.
@npryce @olivergierke
I have an initial implementation at https://github.com/npathai/hamcrest-jdk8-extras
Please go through it and provide some inputs.
There are three methods: isPresent()
, isEmpty()
and isPresentAnd(Matcher)
. Out of which first two are obvious. The third one is useful for applying matchers on value inside the Optional
instance.
from javahamcrest.
@npryce @npathai
https://github.com/npathai/hamcrest-jdk8-extras looks good, despite the double execution of the matcher in isPresentAnd(Matcher)
. Is there a chance to get it into hamcrest soon?
from javahamcrest.
@scheffield Great. I will get to it soon n remove double execution. I have been busy lately. I will change it this weekend.
from javahamcrest.
@scheffield I have resolved the issue. I will further refine the implementation if I get some reviews.
from javahamcrest.
Does anyone feel we need matchers for new DateTime API of Java8?
from javahamcrest.
@npathai I would rather see your extras merged into core project, but I think you should cover it, since you called your project "jdk8" :)
from javahamcrest.
@matteprl Yes I would like that too. But I didn't get your point.
from javahamcrest.
@npathai's hamcrest-jdk8-extras has been renamed to https://github.com/npathai/hamcrest-optional.
from javahamcrest.
@npathai
@stefanbirkner Thank you for information. I know that library is single file project. But have you considered putting it into maven? I like to keep my dependencies managed, and some people - just like me sometimes use search tool on sites like mvnrepository.com and just type hamcrest jdk8. I think it would also make more people use your library. :)
from javahamcrest.
@matteprl Yes we are already considering that. It will be available very soon. Thanks for your inputs.
from javahamcrest.
Any update about when this will make it into hamcrest project? I have seen that hamcrest-optional from @npathai was forked by @baev for maven release integration (https://github.com/baev/hamcrest-optional). But I would like to see an "official" hamcrest integration. From my point of view it makes totally sense to integrate the hamcrest-optional lib into hamcrest project.
from javahamcrest.
Closing this issue, discussion can continue on #206
from javahamcrest.
Related Issues (20)
- assertThat(this.object, hasProperty("booleanName")) fails to match boolean types and renames the property HOT 1
- The matcher contains() is misleading HOT 2
- FR: Matching maps with various type HOT 1
- oss-fuzz integration
- Participitation in Hacktoberfest? HOT 1
- HasProperty Matcher doesn't work with Java Records HOT 4
- assertThat(Int::class.java, typeCompatibleWith(Number::class.java)) in kotlin always fails
- hamcrest matching on actual empty list fails with nosuchmethoderror HOT 1
- Test output Alignment
- record version fails the hasProperty HOT 2
- has property fails with non public class.. not sure if this correct as per java standards of property
- Double "close-to" matcher that uses the ULP.
- GraalVM Native Image support HOT 4
- Inquiry about Project Activity and Future Plans HOT 15
- Compatibility in java versions HOT 2
- Upgrade build to JDK 1.8 bytecode HOT 1
- Upgrade to latest Gradle HOT 1
- Publish to Maven Central using GitHub Actions HOT 6
- Hamcrest v3.1
- Hamcrest v4.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javahamcrest.