Skip to content
This repository has been archived by the owner on Nov 20, 2022. It is now read-only.

Allow to run assertion on Optional value #16

Closed
wants to merge 1 commit into from
Closed

Allow to run assertion on Optional value #16

wants to merge 1 commit into from

Conversation

twillouer
Copy link
Contributor

Hi,

if you like the idea, we can declinate to more methods, like
presentStringAssert()
presentIterableAssert()

etc

Because of type erasure, we cannot declare a generic presentAssert(Class<String) clazz), presentAssert(Class clazz);
etc

Perhaps you have a better proposal ?

@joel-costigliola
Copy link
Member

maybe something like:

// extract the value as an Object
assertThat(Optional.of("Test")).extractingValue().isEqualTo("Test");
// extract the value as a String
assertThat(Optional.of("Test")).extractingString().startsWith("T");

@twillouer
Copy link
Contributor Author

done :)

@twillouer twillouer changed the title presentAssert extractingValue Feb 8, 2015
@joel-costigliola joel-costigliola changed the title extractingValue Allow to run assertion on Optional value Feb 15, 2015
@joel-costigliola
Copy link
Member

Thanks @twillouer, do you want a release for that (I don't mind doing one)

@twillouer
Copy link
Contributor Author

@joel-costigliola let me implement the others :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants