joel-costigliola / assertj Goto Github PK
View Code? Open in Web Editor NEWAssertJ documentation
AssertJ documentation
example :
assertThat(1 == 0)
does not failExplains why soft assertions and assumptions raise a type safety warning like
Type safety: A generic array of Consumer<String> is created for a varargs parameter
when used with method taking a generic vararg.
Solution add @SuppressWarnings("unchecked")
Most of the pages of assertj.org are generated from simple template, to update the site one's must edit the template and generate the site instead of editing the generated pages.
As master is empty defining gh-pages as default branch (https://help.github.com/articles/setting-the-default-branch/) could be helpful.
What do you think?
also show code completion image ?
This test is failing:
import java.util.ArrayList;
import java.util.List;
import org.assertj.core.api.SoftAssertions;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
*
* @author Ivan (X-NoNAME) Kazakov
* @mailto [email protected]
*/
public class AssertJTesting {
private SoftAssertions s ;
List<Humanoid> lva = new ArrayList<>();
@BeforeMethod
public void setUp(){
s = new SoftAssertions();
lva.add(new Humanoid("one", "oneone"));
lva.add(new Humanoid("two", "twotwo"));
lva.add(new Humanoid("three", "threethree"));
}
public static class Humanoid{
private String name;
private String namename;
public Humanoid(String name, String namename) {
this.name = name;
this.namename = namename;
}
}
@Test
public void test_1(){
s.assertThat(lva).extracting("name")
.contains("one")
.doesNotContain("oneone")
.doesNotContainNull();
s.assertAll();
}
}
Users are often not aware of useful assertions, a guide showing best practice assertions would help a lot.
In answer to: If someones know how to configure IntelliJ Idea to get Eclipse behavior for static import, please let me know, you can start typing assertThat and then invoke completion (Ctrl-Space) twice.
There is new feature in 3.4.0 version:
assertThat(...).isEqualToComparingFieldByFieldRecursively(...)
but comparing lists is still poor, because we have to use equals(...) method when comparing two objects - it is used by default?
We would like to have methods like:
assertThat(<some iterable>).containsExactlyElementsOf(<some iterable>)
- already provided.
assertThat(<some iterable>).containsExactlyElementsOfComparingFieldByField(<some iterable>)
- really missing ๐
assertThat(<some iterable>).containsExactlyElementsOfComparingFieldByFieldRecursively(<some iterable>)
- missing too ๐ ๐ :)
BTW, if possible, I could do this.
On http://joel-costigliola.github.io/assertj/assertj-core.html in the menu on the right side the "Converting TestNG Assertions to AssertJ" section is no longer visible (at least at 1920x1080 and below resolutions). There is no way to even scroll there, so the section seems to be unreachable.
Here's a non exhaustive list, feel free to add a comment to add items to this list.
contains
Should be the same and not too small to be more readable
use assertj organisation pages to host assertj website
We had many questions related to android support, ex: http://stackoverflow.com/questions/41787774/class-file-for-java-nio-file-path-not-found
The code in the public method AbstractSoftAssertions.errorsCollected() (https://github.com/joel-costigliola/assertj-core/blob/master/src/main/java/org/assertj/core/api/AbstractSoftAssertions.java#L104) modifies error list by changing their messages, even though the list itself is immutable.
Just like https://github.com/joel-costigliola/assertj/blob/gh-pages/assertj-core-converting-junit-assertions-to-assertj.html but then for TestNG
Hi, I noticed that when I use extracting(), there are no NumberAssertions. I have numeric collections with ints and doubles and it would be very handy if I could do doesNotContainZero() or other numeric asserts.
Example:
assertThat(Collections.<BigInteger>emptyList()).extracting(BigInteger::intValue).doesNotContainZero()
The target link must change according to the actual page, for example if we are on Guava assertions page the ribbon link must point to assertj-guava.
need to do some null safe check : http://joel-costigliola.github.io/assertj/assertj-core-custom-assertions.html
Development of AssertJ-Android was stopped and the library is now deprecated (see: https://github.com/square/assertj-android).
Square actually suggest using Google Truth because of better extensibility.
The https://github.com/joel-costigliola/assertj-neo4j project has not been active for over two years. It only has seven stars on github. The examples of the assertj-examples project do not seem to work with the current neo4j release (3.0
). Maybe it's time to remove the project from the assertj website or at least to mark it as unmaintained?
... see AbstractHumanAssert
hierarchy in https://github.com/joel-costigliola/assertj-examples/tree/master/assertions-examples/src/test/java/org/assertj/examples/custom
When assertj/assertj#1350 is ready then we need to add info about Junit5 script to http://joel-costigliola.github.io/assertj/assertj-core-converting-junit-assertions-to-assertj.html
I will be happy to give it a try.
and complete it !
Hi, at the moment I have this:
assertThat(response.getSteps()).flatExtracting(input ->
asList(input.getPeriod(),
input.getAmount(),
input.getNr())
).doesNotContain(0);
Would it be possible to support the following notations?
Like extracting():
.flatExtracting(
Step::getPeriod,
Step::getAmount,
Step::getNr
)
Or accept a stream like flatMap()?
.flatExtracting(
Stream.of(input.getPeriod(),
input.getAmount(),
input.getNr())
)
Should escape ()
e.g. to the faq section?
At the moment http://joel-costigliola.github.io/assertj/core/api/index.html displays 2.x
javadoc.
I guess this should now display 3.x
javadoc?
What do you think?
This repository contains the AssertJ website.
Please use https://github.com/joel-costigliola/assertj-core/issues to create issues for AssertJ Core itself.
hello,
Does this assert liberty is active? none of the documentation links are working
related to assertj/assertj#1228 (comment)
http://joel-costigliola.github.io/assertj/assertj-core-news.html is back to 3.5.0
http://joel-costigliola.github.io/assertj/assertj-core-older-releases.html is up till 2.9.1
Where's are the notes for in between?
This repository contains the AssertJ website.
Please use https://github.com/joel-costigliola/assertj-core/issues to create issues for AssertJ Core itself.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.