io.airlift.testing.Assertions.assertLessThanOrEqual()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(33)

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

Assertions.assertLessThanOrEqual介绍

暂无

代码示例

代码示例来源:origin: prestodb/presto

@Override
  public void write(byte[] source, int sourceIndex, int length)
  {
    assertLessThanOrEqual(length, 4096);
    super.write(source, sourceIndex, length);
  }
}

代码示例来源:origin: prestodb/presto

private static void assertPageSize(List<Page> pages, long maxPageSizeInBytes)
{
  for (Page page : pages) {
    assertLessThanOrEqual(page.getSizeInBytes(), maxPageSizeInBytes);
  }
}

代码示例来源:origin: io.airlift/testing

public static <T extends Comparable<T>> void assertLessThanOrEqual(T actual, T expected)
{
  assertLessThanOrEqual(actual, expected, null);
}

代码示例来源:origin: com.teradata.airlift/testing

public static <T extends Comparable<T>> void assertLessThanOrEqual(T actual, T expected)
{
  assertLessThanOrEqual(actual, expected, null);
}

代码示例来源:origin: airlift/airlift

public static <T extends Comparable<T>> void assertLessThanOrEqual(T actual, T expected)
{
  assertLessThanOrEqual(actual, expected, null);
}

代码示例来源:origin: io.airlift/testing

@SuppressWarnings({"unchecked", "rawtypes"})
public void passLessThanOrEqual(Comparable actual, Comparable expected)
{
  assertLessThanOrEqual(actual, expected);
  assertLessThanOrEqual(actual, expected, MESSAGE);
}

代码示例来源:origin: airlift/airlift

@SuppressWarnings({"unchecked", "rawtypes"})
public void passLessThanOrEqual(Comparable actual, Comparable expected)
{
  assertLessThanOrEqual(actual, expected);
  assertLessThanOrEqual(actual, expected, MESSAGE);
}

代码示例来源:origin: com.teradata.airlift/testing

@SuppressWarnings({"RawUseOfParameterizedType"})
public void passLessThanOrEqual(Comparable actual, Comparable expected)
{
  Assertions.assertLessThanOrEqual(actual, expected);
  Assertions.assertLessThanOrEqual(actual, expected, MESSAGE);
}

代码示例来源:origin: io.prestosql/presto-rcfile

@Override
  public void write(byte[] source, int sourceIndex, int length)
  {
    assertLessThanOrEqual(length, 4096);
    super.write(source, sourceIndex, length);
  }
}

代码示例来源:origin: com.facebook.presto/presto-rcfile

@Override
  public void write(byte[] source, int sourceIndex, int length)
  {
    assertLessThanOrEqual(length, 4096);
    super.write(source, sourceIndex, length);
  }
}

代码示例来源:origin: prestosql/presto

@Override
  public void write(byte[] source, int sourceIndex, int length)
  {
    assertLessThanOrEqual(length, 4096);
    super.write(source, sourceIndex, length);
  }
}

代码示例来源:origin: airlift/airlift

private static RuntimeException assertFailedConcurrency(AtomicInteger concurrency)
{
  int currentConcurrency = concurrency.incrementAndGet();
  assertLessThanOrEqual(currentConcurrency, 2);
  Uninterruptibles.sleepUninterruptibly(1, TimeUnit.MILLISECONDS);
  concurrency.decrementAndGet();
  throw new IllegalStateException();
}

代码示例来源:origin: io.airlift/concurrent

private static RuntimeException assertFailedConcurrency(AtomicInteger concurrency)
{
  int currentConcurrency = concurrency.incrementAndGet();
  assertLessThanOrEqual(currentConcurrency, 2);
  Uninterruptibles.sleepUninterruptibly(1, TimeUnit.MILLISECONDS);
  concurrency.decrementAndGet();
  throw new IllegalStateException();
}

代码示例来源:origin: com.teradata.airlift/concurrent

private static RuntimeException assertFailedConcurrency(AtomicInteger concurrency)
{
  int currentConcurrency = concurrency.incrementAndGet();
  assertLessThanOrEqual(currentConcurrency, 2);
  Uninterruptibles.sleepUninterruptibly(1, TimeUnit.MILLISECONDS);
  concurrency.decrementAndGet();
  throw new IllegalStateException();
}

代码示例来源:origin: prestosql/presto

private static void assertPageSize(List<Page> pages, long maxPageSizeInBytes)
{
  for (Page page : pages) {
    assertLessThanOrEqual(page.getSizeInBytes(), maxPageSizeInBytes);
  }
}

代码示例来源:origin: io.prestosql/presto-main

private static void assertPageSize(List<Page> pages, long maxPageSizeInBytes)
{
  for (Page page : pages) {
    assertLessThanOrEqual(page.getSizeInBytes(), maxPageSizeInBytes);
  }
}

代码示例来源:origin: uk.co.nichesolutions.presto/presto-main

private static void assertPageSize(List<Page> pages, long maxPageSizeInBytes)
{
  for (Page page : pages) {
    assertLessThanOrEqual(page.getSizeInBytes(), maxPageSizeInBytes);
  }
}

代码示例来源:origin: airlift/airlift

@SuppressWarnings({"unchecked", "rawtypes"})
public void failLessThanOrEqual(Comparable actual, Comparable expected)
{
  try {
    assertLessThanOrEqual(actual, expected);
    fail("Expected AssertionError");
  }
  catch (AssertionError e) {
    verifyExceptionMessage(e, null, actual, expected);
  }
  try {
    assertLessThanOrEqual(actual, expected, MESSAGE);
    fail("Expected AssertionError");
  }
  catch (AssertionError e) {
    verifyExceptionMessage(e, MESSAGE, actual, expected);
  }
}

代码示例来源:origin: com.teradata.airlift/testing

@SuppressWarnings({"RawUseOfParameterizedType"})
public void failLessThanOrEqual(Comparable actual, Comparable expected)
{
  try {
    Assertions.assertLessThanOrEqual(actual, expected);
    Assert.fail("Expected AssertionError");
  }
  catch (AssertionError e) {
    verifyExceptionMessage(e, null, actual, expected);
  }
  try {
    Assertions.assertLessThanOrEqual(actual, expected, MESSAGE);
    Assert.fail("Expected AssertionError");
  }
  catch (AssertionError e) {
    verifyExceptionMessage(e, MESSAGE, actual, expected);
  }
}

代码示例来源:origin: io.airlift/concurrent

@Test
public void testSingleThreadBoundedConcurrency()
    throws Exception
{
  AsyncSemaphore<Runnable> asyncSemaphore = new AsyncSemaphore<>(1, executor, executor::submit);
  AtomicInteger count = new AtomicInteger();
  AtomicInteger concurrency = new AtomicInteger();
  List<ListenableFuture<?>> futures = new ArrayList<>();
  for (int i = 0; i < 1000; i++) {
    futures.add(asyncSemaphore.submit((Runnable) () -> {
      count.incrementAndGet();
      int currentConcurrency = concurrency.incrementAndGet();
      assertLessThanOrEqual(currentConcurrency, 1);
      Uninterruptibles.sleepUninterruptibly(1, TimeUnit.MILLISECONDS);
      concurrency.decrementAndGet();
    }));
  }
  // Wait for completion
  Futures.allAsList(futures).get(1, TimeUnit.MINUTES);
  assertEquals(count.get(), 1000);
}

相关文章