Java 类org.hamcrest.number.OrderingComparison 实例源码

项目:redsniff    文件:WebTesterTableTest.java   
@Test
public void 
parsesLargeTableInReasonableTime(){
    thrown.expect(AssertionError.class);
    WebElement table = t.find(only(tableElement().that(hasName("a_large_table_with_11_cols_34_rows"))));
    long timeBefore = System.currentTimeMillis();


    //TODO - figure out if can get rid of needing dataCellWithTextfix IsTableCell.with to accept string matchers as well as cell matchers
    assertThat(table,isTableElementThat(hasDataRows(
            includesCells(valueInColumn("Stock Code",cellWithText(startsWith("VOD.L"))),         valueInColumn("Price","1.23")),
            includesCells(valueInColumn("Stock Description",cellWithText(startsWith("Marks"))),  valueInColumn("Price","4.56")),
            includesCells(valueInColumn(4,"GB")),
            includesCells(valueInColumn("Country","US")))));
    int timeTakenSecs = (int) ((System.currentTimeMillis()-timeBefore)/1000l);
    System.out.println("completed in " + timeTakenSecs + " seconds");
    assertThat("completes in less than 10 seconds",timeTakenSecs,OrderingComparison.lessThan(10));

}
项目:randomito-all    文件:RandomitoTest.java   
@Test
public void test8_disableJsr303Validation() {
    // given
    Randomito.custom().disableJsr303().init(this);

    // then
    assertThat(test8_user, is(notNullValue()));
    // by default generated String is of length 150
    assertThat(test8_user.getLogin().length(), OrderingComparison.greaterThan(30));
}
项目:randomito-all    文件:FutureAnnotationPostProcessorTest.java   
@Test
public void testFuture() {
    // given
    Wrapper wrapper = new Wrapper();

    Date future = postprocess(wrapper, "future", Date.class);

    Assert.assertThat(future, OrderingComparison.greaterThan(new Date()));
}
项目:randomito-all    文件:PastAnnotationPostProcessorTest.java   
@Test
public void testPast() {
    // given
    Wrapper wrapper = new Wrapper();

    Date past = postprocess(wrapper, "past", Date.class);

    Assert.assertThat(past, OrderingComparison.lessThan(new Date()));
}
项目:randomito-all    文件:MinMaxAnnotationPostProcessorTest.java   
@Test
public void testMinAnnotation() {
    // given
    Wrapper wrapper = new Wrapper();

    // when
    Integer min = postprocess(wrapper, "min", Integer.class);

    // then
    Assert.assertThat(min, OrderingComparison.greaterThanOrEqualTo(10));
}
项目:randomito-all    文件:MinMaxAnnotationPostProcessorTest.java   
@Test
public void testMaxAnnotation() {
    // given
    Wrapper wrapper = new Wrapper();

    // when
    Long max = postprocess(wrapper, "max", Long.class);

    // then
    Assert.assertThat(max, OrderingComparison.lessThan(10l));
}
项目:randomito-all    文件:MinMaxAnnotationPostProcessorTest.java   
@Test
public void testMinMaxAnnotation() {
    // given
    Wrapper wrapper = new Wrapper();

    // when
    Float minMax = postprocess(wrapper, "minMax", Float.class);

    // then
    Assert.assertThat(minMax, OrderingComparison.greaterThanOrEqualTo(5f));
    Assert.assertThat(minMax, OrderingComparison.lessThan(10f));
}
项目:randomito-all    文件:MinMaxAnnotationPostProcessorTest.java   
@Test
public void testMinMaxOnStringAnnotation() {
    // given
    Wrapper wrapper = new Wrapper();
    wrapper.string = "abcdefghijklmon.......";

    // when
    String minMax = postprocess(wrapper, "string", String.class);

    // then
    Assert.assertThat(minMax.length(), OrderingComparison.greaterThan(2));
    Assert.assertThat(minMax.length(), OrderingComparison.lessThanOrEqualTo(5));
}
项目:randomito-all    文件:SizeAnnotationPostProcessorTest.java   
@Test
public void testSizeOnInt() {
    // given
    Wrapper wrapper = new Wrapper();

    // when
    Integer anInt = postprocess(wrapper, "anInt", Integer.class);

    // then
    Assert.assertThat(anInt, OrderingComparison.lessThan(20));
}
项目:offheap-store    文件:UpfrontAllocatingPageSourceThresholdTest.java   
@Test
public void testThresholdsDuringSteal() {
  UpfrontAllocatingPageSource source = new UpfrontAllocatingPageSource(new HeapBufferSource(), MemoryUnit.KILOBYTES.toBytes(1), MemoryUnit.KILOBYTES.toBytes(1));
  SimpleOwner owner = new SimpleOwner();
  OffHeapStorageArea storage = new OffHeapStorageArea(PointerSize.INT, owner, source, 128, false, true);
  owner.bind(storage);

  final AtomicBoolean rising512 = new AtomicBoolean();
  source.addAllocationThreshold(ThresholdDirection.RISING, 512, () -> rising512.set(true));
  final AtomicBoolean falling64 = new AtomicBoolean();
  source.addAllocationThreshold(ThresholdDirection.FALLING, 64, () -> falling64.set(true));

  long victim = storage.allocate(128);
  assertThat(victim, OrderingComparison.greaterThanOrEqualTo(0L));
  assertThat(rising512.getAndSet(false), is(false));
  assertThat(falling64.getAndSet(false), is(false));

  Page thief = source.allocate(1024, true, false, null);
  assertThat(thief, IsNull.notNullValue());
  assertThat(storage.getAllocatedMemory(), is(0L));
  assertThat(rising512.getAndSet(false), is(true));
  assertThat(falling64.getAndSet(false), is(true));

  long fail = storage.allocate(128);
  assertThat(fail, is(-1L));
  assertThat(storage.getAllocatedMemory(), is(0L));
  assertThat(rising512.getAndSet(false), is(false));
  assertThat(falling64.getAndSet(false), is(false));

  source.free(thief);
  assertThat(storage.getAllocatedMemory(), is(0L));
  assertThat(source.getAllocatedSize(), is(0L));
  assertThat(rising512.getAndSet(false), is(false));
  assertThat(falling64.getAndSet(false), is(true));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>byte</code> parameter greater than or equal to the given value.
 *
 * @return <code>0</code>
 */
static public byte geq(byte value) {
    return argThat(Byte.TYPE, OrderingComparison.greaterThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>char</code> parameter greater than or equal to the given value.
 *
 * @return <code>'\0'</code>
 */
static public char geq(char value) {
    return argThat(Character.TYPE, OrderingComparison.greaterThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a {@link Comparable} parameter greater than or equal to the given value.
 *
 * @return <code>null</code>
 */
@SuppressWarnings("unchecked")
static public <T extends Comparable<T>> T geq(T value) {
    return (T) argThat(Comparable.class, (Matcher) OrderingComparison.greaterThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>double</code> parameter greater than or equal to the given value.
 *
 * @return <code>0</code>
 */
static public double geq(double value) {
    return argThat(Double.TYPE, OrderingComparison.greaterThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>float</code> parameter greater than or equal to the given value.
 *
 * @return <code>0</code>
 */
static public float geq(float value) {
    return argThat(Float.TYPE, OrderingComparison.greaterThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches an <code>int</code> parameter greater than or equal to the given value.
 *
 * @return <code>0</code>
 */
static public int geq(int value) {
    return argThat(Integer.TYPE, OrderingComparison.greaterThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>long</code> parameter greater than or equal to the given value.
 *
 * @return <code>0</code>
 */
static public long geq(long value) {
    return argThat(Long.TYPE, OrderingComparison.greaterThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>short</code> parameter greater than or equal to the given value.
 *
 * @return <code>0</code>
 */
static public short geq(short value) {
    return argThat(Short.TYPE, OrderingComparison.greaterThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>byte</code> parameter greater than the given value.
 *
 * @return <code>0</code>
 */
static public byte gt(byte value) {
    return argThat(Byte.TYPE, OrderingComparison.greaterThan(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>char</code> parameter greater than the given value.
 *
 * @return <code>'\0'</code>
 */
static public char gt(char value) {
    return argThat(Character.TYPE, OrderingComparison.greaterThan(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a {@link Comparable} parameter greater than the given value.
 *
 * @return <code>null</code>
 */
@SuppressWarnings("unchecked")
static public <T extends Comparable<T>> T gt(T value) {
    return (T) argThat(Comparable.class, (Matcher) OrderingComparison.greaterThan(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>double</code> parameter greater than the given value.
 *
 * @return <code>0</code>
 */
static public double gt(double value) {
    return argThat(Double.TYPE, OrderingComparison.greaterThan(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>float</code> parameter greater than the given value.
 *
 * @return <code>0</code>
 */
static public float gt(float value) {
    return argThat(Float.TYPE, OrderingComparison.greaterThan(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches an <code>int</code> parameter greater than the given value.
 *
 * @return <code>0</code>
 */
static public int gt(int value) {
    return argThat(Integer.TYPE, OrderingComparison.greaterThan(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>long</code> parameter greater than the given value.
 *
 * @return <code>0</code>
 */
static public long gt(long value) {
    return argThat(Long.TYPE, OrderingComparison.greaterThan(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>short</code> parameter greater than the given value.
 *
 * @return <code>0</code>
 */
static public short gt(short value) {
    return argThat(Short.TYPE, OrderingComparison.greaterThan(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>byte</code> parameter less than or equal to the given value.
 *
 * @return <code>0</code>
 */
static public byte leq(byte value) {
    return argThat(Byte.TYPE, OrderingComparison.lessThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>char</code> parameter less than or equal to the given value.
 *
 * @return <code>'\0'</code>
 */
static public char leq(char value) {
    return argThat(Character.TYPE, OrderingComparison.lessThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a {@link Comparable} parameter less than or equal to the given value.
 *
 * @return <code>null</code>
 */
@SuppressWarnings("unchecked")
static public <T extends Comparable<T>> T leq(T value) {
    return (T) argThat(Comparable.class, (Matcher) OrderingComparison.lessThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>double</code> parameter less than or equal to the given value.
 *
 * @return <code>0</code>
 */
static public double leq(double value) {
    return argThat(Double.TYPE, OrderingComparison.lessThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>float</code> parameter less than or equal to the given value.
 *
 * @return <code>0</code>
 */
static public float leq(float value) {
    return argThat(Float.TYPE, OrderingComparison.lessThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches an <code>int</code> parameter less than or equal to the given value.
 *
 * @return <code>0</code>
 */
static public int leq(int value) {
    return argThat(Integer.TYPE, OrderingComparison.lessThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>long</code> parameter less than or equal to the given value.
 *
 * @return <code>0</code>
 */
static public long leq(long value) {
    return argThat(Long.TYPE, OrderingComparison.lessThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>short</code> parameter less than or equal to the given value.
 *
 * @return <code>0</code>
 */
static public short leq(short value) {
    return argThat(Short.TYPE, OrderingComparison.lessThanOrEqualTo(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>byte</code> parameter less than the given value.
 *
 * @return <code>0</code>
 */
static public byte lt(byte value) {
    return argThat(Byte.TYPE, OrderingComparison.lessThan(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>char</code> parameter less than the given value.
 *
 * @return <code>'\0'</code>
 */
static public char lt(char value) {
    return argThat(Character.TYPE, OrderingComparison.lessThan(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a {@link Comparable} parameter less than the given value.
 *
 * @return <code>null</code>
 */
@SuppressWarnings("unchecked")
static public <T extends Comparable<T>> T lt(T value) {
    return (T) argThat(Comparable.class, (Matcher) OrderingComparison.lessThan(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>double</code> parameter less than the given value.
 *
 * @return <code>0</code>
 */
static public double lt(double value) {
    return argThat(Double.TYPE, OrderingComparison.lessThan(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches a <code>float</code> parameter less than the given value.
 *
 * @return <code>0</code>
 */
static public float lt(float value) {
    return argThat(Float.TYPE, OrderingComparison.lessThan(value));
}
项目:moxiemocks    文件:MoxieMatchers.java   
/**
 * Matches an <code>int</code> parameter less than the given value.
 *
 * @return <code>0</code>
 */
static public int lt(int value) {
    return argThat(Integer.TYPE, OrderingComparison.lessThan(value));
}