/** * Verifies that the actual value is equal to the given one. * <p> * Example: * <pre><code class='java'> // assertion will pass: * assertThat(Short.valueOf("1")).isEqualTo((short) 1); * * // assertion will fail: * assertThat(Short.valueOf("-1")).isEqualTo((short) 1);</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}. * @throws AssertionError if the actual value is not equal to the given one. */ public SELF isEqualTo(short expected) { shorts.assertEqual(info, actual, expected); return myself; }
/** * Verifies that the actual value is greater than the given one. * <p> * Example: * <pre><code class='java'> // assertion will pass: * assertThat(Short.valueOf("1")).isGreaterThan((short) 0); * * // assertions will fail: * assertThat(Short.valueOf("0")).isGreaterThan((short) 1); * assertThat(Short.valueOf("0")).isGreaterThan((short) 0);</code></pre> * * @param other the given value to compare the actual value to. * @return {@code this} assertion object. * @throws AssertionError if the actual value is {@code null}. * @throws AssertionError if the actual value is equal to or less than the given one. */ public SELF isGreaterThan(short other) { shorts.assertGreaterThan(info, actual, other); return myself; }
/** * Verifies that the actual value is greater than or equal to the given one. * <p> * Example: * <pre><code class='java'> // assertion will pass: * assertThat(Short.valueOf("1")).isGreaterThanOrEqualTo((short) 1); * * // assertion will fail: * assertThat(Short.valueOf("0")).isGreaterThanOrEqualTo((short) 1);</code></pre> * * @param other the given value to compare the actual value to. * @return {@code this} assertion object. * @throws AssertionError if the actual value is {@code null}. * @throws AssertionError if the actual value is less than the given one. */ public SELF isGreaterThanOrEqualTo(short other) { shorts.assertGreaterThanOrEqualTo(info, actual, other); return myself; }
@Override @CheckReturnValue public SELF usingComparator(Comparator<? super Short> customComparator, String customComparatorDescription) { shorts = new Shorts(new ComparatorBasedComparisonStrategy(customComparator, customComparatorDescription)); return super.usingComparator(customComparator, customComparatorDescription); }
/** {@inheritDoc} */ @Override public SELF isNotZero() { shorts.assertIsNotZero(info, actual); return myself; }
/** {@inheritDoc} */ @Override public SELF isNegative() { shorts.assertIsNegative(info, actual); return myself; }
/** {@inheritDoc} */ @Override public SELF isNotPositive() { shorts.assertIsNotPositive(info, actual); return myself; }
/** {@inheritDoc} */ @Override public SELF isPositive() { shorts.assertIsPositive(info, actual); return myself; }
/** {@inheritDoc} */ @Override public SELF isNotNegative() { shorts.assertIsNotNegative(info, actual); return myself; }
/** * Verifies that the actual value is in [start, end] range (start included, end included). * * <p> * Example: * <pre><code class='java'> // assertions will pass * assertThat((short) 1).isBetween((short) -1, (short) 2); * assertThat((short) 1).isBetween((short) 1, (short) 2); * assertThat((short) 1).isBetween((short) 0, (short) 1); * * // assertion will fail * assertThat((short) 1).isBetween((short) 2, (short) 3);</code></pre> */ @Override public SELF isBetween(Short start, Short end) { shorts.assertIsBetween(info, actual, start, end); return myself; }
@Override @CheckReturnValue public SELF usingComparator(Comparator<? super Short> customComparator, String customComparatorDescription) { shorts = new Shorts(new ComparatorBasedComparisonStrategy(customComparator, customComparatorDescription)); return super.usingComparator(customComparator, customComparatorDescription); }
/** {@inheritDoc} */ @Override public SELF isNotZero() { shorts.assertIsNotZero(info, actual); return myself; }
/** {@inheritDoc} */ @Override public SELF isNegative() { shorts.assertIsNegative(info, actual); return myself; }
/** {@inheritDoc} */ @Override public SELF isNotPositive() { shorts.assertIsNotPositive(info, actual); return myself; }
/** {@inheritDoc} */ @Override public SELF isPositive() { shorts.assertIsPositive(info, actual); return myself; }
/** {@inheritDoc} */ @Override public SELF isNotNegative() { shorts.assertIsNotNegative(info, actual); return myself; }
/** * Verifies that the actual value is in [start, end] range (start included, end included). * * <p> * Example: * <pre><code class='java'> // assertions will pass * assertThat((short) 1).isBetween((short) -1, (short) 2); * assertThat((short) 1).isBetween((short) 1, (short) 2); * assertThat((short) 1).isBetween((short) 0, (short) 1); * * // assertion will fail * assertThat((short) 1).isBetween((short) 2, (short) 3);</code></pre> */ @Override public SELF isBetween(Short start, Short end) { shorts.assertIsBetween(info, actual, start, end); return myself; }
Clothes coolshirt=new Shirt(); Clothes coolshorts=new Shorts(); Clothes cooljeans=new Jeans(); Clothes gift=receiveGift(); if(gift instanceof Shirt)//Is the gift refers to a instance of Shirt sendGratitude("Thanks for your new Shirt. It is really cool"); else if(gift instanceof Shorts)//Is the gift refers to a instance of Shorts sendGratitude("Your shorts fits nice for me.Thank you."); else if(gift instanceof Jeans)//Is the gift refers to a instance of Jeans sendGratitude("In your Jeans I really look, Handsome, Very Thanks");
/** {@inheritDoc} */ @Override public S isNotZero() { shorts.assertIsNotZero(info, actual); return myself; }
/** {@inheritDoc} */ @Override public S isNegative() { shorts.assertIsNegative(info, actual); return myself; }