org.assertj.core.data.Offset.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(5.4k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中org.assertj.core.data.Offset.<init>()方法的一些代码示例,展示了Offset.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Offset.<init>()方法的具体详情如下:
包路径:org.assertj.core.data.Offset
类名称:Offset
方法名:<init>

Offset.<init>介绍

暂无

代码示例

代码示例来源:origin: org.assertj/assertj-core

/**
 * Creates a new strict {@link Offset} that let {@code isCloseTo} assertion pass when {@code |actual-expected| < offset value}.
 * <p>
 * Examples:
 * <pre><code class='java'> // assertion succeeds
 * assertThat(8.1).isCloseTo(8.0, offset(0.2));
 *
 * // assertions fail
 * assertThat(8.1).isCloseTo(8.0, offset(0.1));
 * assertThat(8.1).isCloseTo(8.0, offset(0.01));</code></pre>
 *
 * @param <T> the type of value of the {@link Offset}.
 * @param value the value of the offset.
 * @return the created {@code Offset}.
 * @throws NullPointerException if the given value is {@code null}.
 * @throws IllegalArgumentException if the given value is negative.
 */
public static <T extends Number> Offset<T> strictOffset(T value) {
 checkNotNull(value);
 checkArgument(value.doubleValue() > 0d, "A strict offset value should be greater than zero");
 return new Offset<>(value, true);
}

代码示例来源:origin: org.assertj/assertj-core

/**
 * Creates a new {@link Offset} that let {@code isCloseTo} assertions pass when {@code |actual-expected| <= offset value}.
 * <p>
 * Example:
 * <pre><code class='java'> // assertions succeed
 * assertThat(8.1).isCloseTo(8.0, offset(0.2));
 * assertThat(8.1).isCloseTo(8.0, offset(0.1));
 *
 * // assertion fails
 * assertThat(8.1).isCloseTo(8.0, offset(0.01));</code></pre>
 *
 * @param <T> the type of value of the {@link Offset}.
 * @param value the value of the offset.
 * @return the created {@code Offset}.
 * @throws NullPointerException if the given value is {@code null}.
 * @throws IllegalArgumentException if the given value is negative.
 */
public static <T extends Number> Offset<T> offset(T value) {
 checkNotNull(value);
 checkArgument(value.doubleValue() >= 0d, "An offset value should be greater than or equal to zero");
 return new Offset<>(value, false);
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Creates a new {@link Offset} that let {@code isCloseTo} assertions pass when {@code |actual-expected| <= offset value}.
 * <p>
 * Example:
 * <pre><code class='java'> // assertions succeed
 * assertThat(8.1).isCloseTo(8.0, offset(0.2));
 * assertThat(8.1).isCloseTo(8.0, offset(0.1));
 *
 * // assertion fails
 * assertThat(8.1).isCloseTo(8.0, offset(0.01));</code></pre>
 *
 * @param <T> the type of value of the {@link Offset}.
 * @param value the value of the offset.
 * @return the created {@code Offset}.
 * @throws NullPointerException if the given value is {@code null}.
 * @throws IllegalArgumentException if the given value is negative.
 */
public static <T extends Number> Offset<T> offset(T value) {
 checkNotNull(value);
 checkArgument(value.doubleValue() >= 0d, "An offset value should be greater than or equal to zero");
 return new Offset<>(value, false);
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Creates a new strict {@link Offset} that let {@code isCloseTo} assertion pass when {@code |actual-expected| < offset value}.
 * <p>
 * Examples:
 * <pre><code class='java'> // assertion succeeds
 * assertThat(8.1).isCloseTo(8.0, offset(0.2));
 *
 * // assertions fail
 * assertThat(8.1).isCloseTo(8.0, offset(0.1));
 * assertThat(8.1).isCloseTo(8.0, offset(0.01));</code></pre>
 *
 * @param <T> the type of value of the {@link Offset}.
 * @param value the value of the offset.
 * @return the created {@code Offset}.
 * @throws NullPointerException if the given value is {@code null}.
 * @throws IllegalArgumentException if the given value is negative.
 */
public static <T extends Number> Offset<T> strictOffset(T value) {
 checkNotNull(value);
 checkArgument(value.doubleValue() > 0d, "A strict offset value should be greater than zero");
 return new Offset<>(value, true);
}

代码示例来源:origin: org.assertj/assertj-core-java8

/**
 * Creates a new {@link Offset}.
 *
 * @param value the value of the offset.
 * @return the created {@code Offset}.
 * @throws NullPointerException if the given value is {@code null}.
 * @throws IllegalArgumentException if the given value is negative.
 */
public static Offset<BigDecimal> offset(final BigDecimal value) {
 checkNotNull(value);
 if (value.compareTo(BigDecimal.ZERO) < 0) throw valueNotPositive();
 return new Offset<BigDecimal>(value);
}

代码示例来源:origin: org.assertj/assertj-core-java8

/**
 * Creates a new {@link Offset}.
 *
 * @param value the value of the offset.
 * @return the created {@code Offset}.
 * @throws NullPointerException if the given value is {@code null}.
 * @throws IllegalArgumentException if the given value is negative.
 */
public static Offset<Integer> offset(Integer value) {
 checkNotNull(value);
 if (value < 0) {
  throw valueNotPositive();
 }
 return new Offset<Integer>(value);
}

代码示例来源:origin: org.assertj/assertj-core-java8

/**
 * Creates a new {@link Offset}.
 *
 * @param value the value of the offset.
 * @return the created {@code Offset}.
 * @throws NullPointerException if the given value is {@code null}.
 * @throws IllegalArgumentException if the given value is negative.
 */
public static Offset<Double> offset(Double value) {
 checkNotNull(value);
 if (value < 0d) {
  throw valueNotPositive();
 }
 return new Offset<Double>(value);
}

代码示例来源:origin: org.assertj/assertj-core-java8

/**
 * Creates a new {@link Offset}.
 *
 * @param value the value of the offset.
 * @return the created {@code Offset}.
 * @throws NullPointerException if the given value is {@code null}.
 * @throws IllegalArgumentException if the given value is negative.
 */
public static Offset<Float> offset(Float value) {
 checkNotNull(value);
 if (value < 0f) {
  throw valueNotPositive();
 }
 return new Offset<Float>(value);
}

相关文章

微信公众号

最新文章

更多