Skip to content

Commit

Permalink
#4 : Some more missing javadoc code examples
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalSchumacher authored and joel-costigliola committed Oct 28, 2015
1 parent e113706 commit 2b3335d
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/main/java/org/assertj/core/api/AbstractBooleanAssert.java
Expand Up @@ -41,6 +41,15 @@ protected AbstractBooleanAssert(Boolean actual, Class<?> selfType) {

/**
* Verifies that the actual value is {@code true}.
* <p/>
* Example:
* <pre><code class='java'> // assertions will pass
* assertThat(true).isTrue();
* assertThat(Boolean.TRUE).isTrue();
*
* // assertions will fail
* assertThat(false).isTrue();
* assertThat(Boolean.FALSE).isTrue();</code></pre>
*
* @return {@code this} assertion object.
* @throws AssertionError if the actual value is {@code null}.
Expand All @@ -52,6 +61,15 @@ public S isTrue() {

/**
* Verifies that the actual value is {@code false}.
* <p/>
* Example:
* <pre><code class='java'> // assertions will pass
* assertThat(false).isFalse();
* assertThat(Boolean.FALSE).isFalse();
*
* // assertions will fail
* assertThat(true).isFalse();
* assertThat(Boolean.TRUE).isFalse();</code></pre>
*
* @return {@code this} assertion object.
* @throws AssertionError if the actual value is {@code null}.
Expand All @@ -63,6 +81,15 @@ public S isFalse() {

/**
* Verifies that the actual value is equal to the given one.
* <p/>
* Example:
* <pre><code class='java'> // assertions will pass
* assertThat(true).isEqualTo(true);
* assertThat(Boolean.FALSE).isEqualTo(false);
*
* // assertions will fail
* assertThat(true).isEqualTo(false);
* assertThat(Boolean.TRUE).isEqualTo(false);</code></pre>
*
* @param expected the given value to compare the actual value to.
* @return {@code this} assertion object.
Expand All @@ -76,6 +103,15 @@ public S isEqualTo(boolean expected) {

/**
* Verifies that the actual value is not equal to the given one.
* <p/>
* Example:
* <pre><code class='java'> // assertions will pass
* assertThat(true).isNotEqualTo(false);
* assertThat(Boolean.FALSE).isNotEqualTo(true);
*
* // assertions will fail
* assertThat(true).isNotEqualTo(true);
* assertThat(Boolean.FALSE).isNotEqualTo(false);</code></pre>
*
* @param other the given value to compare the actual value to.
* @return {@code this} assertion object.
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/org/assertj/core/api/AbstractByteAssert.java
Expand Up @@ -46,7 +46,16 @@ protected AbstractByteAssert(Byte actual, Class<?> selfType) {

/**
* Verifies that the actual value is equal to the given one.
* <p/>
* Example:
* <pre><code class='java'> // assertions will pass
* assertThat((byte) 1).isEqualTo((byte) 1);
* assertThat((byte) 0).isEqualTo(Byte.valueOf("0"));
*
* // assertions will fail
* assertThat((byte) 1).isEqualTo((byte) 0);
* assertThat(Byte.valueOf("1")).isEqualTo((byte) 0);</code></pre>
*
* @param expected the given value to compare the actual value to.
* @return {@code this} assertion object.
* @throws AssertionError if the actual value is {@code null}.
Expand All @@ -59,6 +68,15 @@ public S isEqualTo(byte expected) {

/**
* Verifies that the actual value is not equal to the given one.
* <p/>
* Example:
* <pre><code class='java'> // assertions will pass
* assertThat((byte) 0).isNotEqualTo((byte) 1);
* assertThat(Byte.valueOf("1")).isNotEqualTo((byte) 0);
*
* // assertions will fail
* assertThat((byte) 0).isNotEqualTo((byte) 0);
* assertThat(Byte.valueOf("0")).isNotEqualTo((byte) 0);</code></pre>
*
* @param other the given value to compare the actual value to.
* @return {@code this} assertion object.
Expand Down
Expand Up @@ -58,7 +58,15 @@ public S hasContentEqualTo(InputStream expected) {

/**
* Verifies that the content of the actual {@code InputStream} is equal to the content of the given one.
* <p/>
* Example:
* <pre><code class='java'> // assertion will pass
* assertThat(new ByteArrayInputStream(new byte[] {0xa})).hasSameContentAs(new ByteArrayInputStream(new byte[] {0xa}));
*
* // assertions will fail
* assertThat(new ByteArrayInputStream(new byte[] {0xa})).hasSameContentAs(new ByteArrayInputStream(new byte[] {}));
* assertThat(new ByteArrayInputStream(new byte[] {0xa})).hasSameContentAs(new ByteArrayInputStream(new byte[] {0xa, 0xc, 0xd}));</code></pre>
*
* @param expected the given {@code InputStream} to compare the actual {@code InputStream} to.
* @return {@code this} assertion object.
* @throws NullPointerException if the given {@code InputStream} is {@code null}.
Expand Down

0 comments on commit 2b3335d

Please sign in to comment.