@Test public void testObservableLongValue(){ ObservableLongValue actual = new SimpleLongProperty(10l); assertThat(actual).hasValue(10l); assertThat(actual).hasSameValue(actual); }
@Test public void should_fail_if_actual_has_wrong_value(){ try{ ObservableLongValue actual = new SimpleLongProperty(1234L); new ObservableValueAssertions<>(actual).hasValue(123L); fail("Should throw an AssertionError"); }catch(AssertionError error){ assertThat(error).hasMessageContaining("<123> but was <1234>"); } }
public LongBinding selectLong(Function<S, ? extends ObservableLongValue> childPropertyAccessor) { return selectLong(childPropertyAccessor, 0L); }
public LongBinding selectLong(Function<S, ? extends ObservableLongValue> childPropertyAccessor, long defaultValue) { return new LongBindingAdapter(new ChainBinding<>(rootProperty, childPropertyAccessor), defaultValue); }
@Test public void should_pass_if_actual_has_given_value(){ ObservableLongValue actual = new SimpleLongProperty(1234L); new ObservableValueAssertions<>(actual).hasValue(1234L); }
/** * Binding for {@link java.lang.Math#abs(long)} * * @param a the argument whose absolute value is to be determined as observableValue * @return the absolute value of the argument. */ public static LongBinding abs(final ObservableLongValue a) { return createLongBinding(() -> Math.abs(a.get()), a); }
/** * Binding for {@link java.lang.Math#addExact(long, long)} * * @param x the first value * @param y the second value * @return the result * @throws ArithmeticException if the result overflows a long * */ public static LongBinding addExact(final ObservableLongValue x, final ObservableLongValue y) { return createLongBinding(() -> Math.addExact(x.get(), y.get()), x, y); }
/** * Binding for {@link java.lang.Math#addExact(long, long)} * * @param x the first value * @param y the second value * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding addExact(final long x, final ObservableLongValue y) { return createLongBinding(() -> Math.addExact(x, y.get()), y); }
/** * Binding for {@link java.lang.Math#addExact(long, long)} * * @param x the first value * @param y the second value * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding addExact(final ObservableLongValue x, final long y) { return createLongBinding(() -> Math.addExact(x.get(), y), x); }
/** * Binding for {@link java.lang.Math#decrementExact(long)} * * @param a the value to decrement * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding decrementExact(final ObservableLongValue a) { return createLongBinding(() -> Math.decrementExact(a.get()), a); }
/** * Binding for {@link java.lang.Math#floorDiv(long, long)} * * @param x the dividend * @param y the divisor * @return the largest (closest to positive infinity) * {@code long} value that is less than or equal to the algebraic quotient. * @throws ArithmeticException if the divisor {@code y} is zero */ public static LongBinding floorDiv(final ObservableLongValue x, final ObservableLongValue y) { return createLongBinding(() -> Math.floorDiv(x.get(), y.get()), x, y); }
/** * Binding for {@link java.lang.Math#floorDiv(long, long)} * * @param x the dividend * @param y the divisor * @return the largest (closest to positive infinity) * {@code long} value that is less than or equal to the algebraic quotient. * @throws ArithmeticException if the divisor {@code y} is zero */ public static LongBinding floorDiv(final long x, final ObservableLongValue y) { return createLongBinding(() -> Math.floorDiv(x, y.get()), y); }
/** * Binding for {@link java.lang.Math#floorDiv(long, long)} * * @param x the dividend * @param y the divisor * @return the largest (closest to positive infinity) * {@code long} value that is less than or equal to the algebraic quotient. * @throws ArithmeticException if the divisor {@code y} is zero */ public static LongBinding floorDiv(final ObservableLongValue x, final long y) { return createLongBinding(() -> Math.floorDiv(x.get(), y), x); }
/** * Binding for {@link java.lang.Math#floorMod(long, long)} * * @param x the dividend * @param y the divisor * @return the floor modulus {@code x - (floorDiv(x, y) * y)} * @throws ArithmeticException if the divisor {@code y} is zero */ public static LongBinding floorMod(final ObservableLongValue x, final ObservableLongValue y) { return createLongBinding(() -> Math.floorMod(x.get(), y.get()), x, y); }
/** * Binding for {@link java.lang.Math#floorMod(long, long)} * * @param x the dividend * @param y the divisor * @return the floor modulus {@code x - (floorDiv(x, y) * y)} * @throws ArithmeticException if the divisor {@code y} is zero */ public static LongBinding floorMod(final long x, final ObservableLongValue y) { return createLongBinding(() -> Math.floorMod(x, y.get()), y); }
/** * Binding for {@link java.lang.Math#floorMod(long, long)} * * @param x the dividend * @param y the divisor * @return the floor modulus {@code x - (floorDiv(x, y) * y)} * @throws ArithmeticException if the divisor {@code y} is zero */ public static LongBinding floorMod(final ObservableLongValue x, final long y) { return createLongBinding(() -> Math.floorMod(x.get(), y), x); }
/** * Binding for {@link java.lang.Math#incrementExact(long)} * * @param a the value to increment * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding incrementExact(final ObservableLongValue a) { return createLongBinding(() -> Math.incrementExact(a.get()), a); }
/** * Binding for {@link java.lang.Math#max(long, long)} * * @param a an argument. * @param b another argument. * @return the larger of {@code a} and {@code b}. */ public static LongBinding max(final ObservableLongValue a, final ObservableLongValue b) { return createLongBinding(() -> Math.max(a.get(), b.get()), a, b); }
/** * Binding for {@link java.lang.Math#max(long, long)} * * @param a an argument. * @param b another argument. * @return the larger of {@code a} and {@code b}. */ public static LongBinding max(final long a, final ObservableLongValue b) { return createLongBinding(() -> Math.max(a, b.get()), b); }
/** * Binding for {@link java.lang.Math#max(long, long)} * * @param a an argument. * @param b another argument. * @return the larger of {@code a} and {@code b}. */ public static LongBinding max(final ObservableLongValue a, final long b) { return createLongBinding(() -> Math.max(a.get(), b), a); }
/** * Binding for {@link java.lang.Math#min(long, long)} * * @param a an argument. * @param b another argument. * @return the smaller of {@code a} and {@code b}. */ public static LongBinding min(final ObservableLongValue a, final ObservableLongValue b) { return createLongBinding(() -> Math.min(a.get(), b.get()), a, b); }
/** * Binding for {@link java.lang.Math#min(long, long)} * * @param a an argument. * @param b another argument. * @return the smaller of {@code a} and {@code b}. */ public static LongBinding min(final long a, final ObservableLongValue b) { return createLongBinding(() -> Math.min(a, b.get()), b); }
/** * Binding for {@link java.lang.Math#min(long, long)} * * @param a an argument. * @param b another argument. * @return the smaller of {@code a} and {@code b}. */ public static LongBinding min(final ObservableLongValue a, final long b) { return createLongBinding(() -> Math.min(a.get(), b), a); }
/** * Binding for {@link java.lang.Math#multiplyExact(long, long)} * * @param x the first value * @param y the second value * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding multiplyExact(final ObservableLongValue x, final ObservableLongValue y) { return createLongBinding(() -> Math.multiplyExact(x.get(), y.get()), x, y); }
/** * Binding for {@link java.lang.Math#multiplyExact(long, long)} * * @param x the first value * @param y the second value * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding multiplyExact(final long x, final ObservableLongValue y) { return createLongBinding(() -> Math.multiplyExact(x, y.get()), y); }
/** * Binding for {@link java.lang.Math#multiplyExact(long, long)} * * @param x the first value * @param y the second value * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding multiplyExact(final ObservableLongValue x, final long y) { return createLongBinding(() -> Math.multiplyExact(x.get(), y), x); }
/** * Binding for {@link java.lang.Math#negateExact(long)} * * @param a the value to negate * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding negateExact(final ObservableLongValue a) { return createLongBinding(() -> Math.negateExact(a.get()), a); }
/** * Binding for {@link java.lang.Math#subtractExact(long, long)} * * @param x the first value * @param y the second value to subtract from the first * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding subtractExact(final ObservableLongValue x, final ObservableLongValue y) { return createLongBinding(() -> Math.subtractExact(x.get(), y.get()), x, y); }
/** * Binding for {@link java.lang.Math#subtractExact(long, long)} * * @param x the first value * @param y the second value to subtract from the first * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding subtractExact(final long x, final ObservableLongValue y) { return createLongBinding(() -> Math.subtractExact(x, y.get()), y); }
/** * Binding for {@link java.lang.Math#subtractExact(long, long)} * * @param x the first value * @param y the second value to subtract from the first * @return the result * @throws ArithmeticException if the result overflows a long */ public static LongBinding subtractExact(final ObservableLongValue x, final long y) { return createLongBinding(() -> Math.subtractExact(x.get(), y), x); }
/** * Binding for {@link java.lang.Math#toIntExact(long)} * * @param value the long value * @return the argument as an int * @throws ArithmeticException if the {@code argument} overflows an int */ public static IntegerBinding toIntExact(final ObservableLongValue value) { return createIntegerBinding(() -> Math.toIntExact(value.get()), value); }