Пример #1
0
  @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));
  }
Пример #2
0
    private final int getRepeatCount(@Nullable RepeatIfFailed repeat) {
      int count = RepeatIfFailed.DEFAULT_MAX_REPEATS;
      if (repeat != null) {
        count = repeat.maxRepeats();
      }

      assertThat("Repeat count must be > 0", count, OrderingComparison.greaterThan(0));
      return count;
    }
Пример #3
0
    private final int getDelayMs(@Nullable RepeatIfFailed repeat) {
      int delay = RepeatIfFailed.DEFAULT_DELAY_MS;
      if (repeat != null) {
        delay = repeat.delayInMS();
      }

      assertThat("Repeat count must be >= 0", delay, OrderingComparison.greaterThanOrEqualTo(0));
      return delay;
    }
Пример #4
0
 /**
  * Multi-thread read, put and removeAll test. This checks for memory leaks using the removeAll
  * which was the known cause of memory leaks with MemoryStore in JCS
  */
 @Test
 public void testMemoryLeak() throws Exception {
   try {
     // Sometimes this can be higher but a three hour run confirms no memory leak. Consider
     // increasing.
     assertThat(thrashCache(), OrderingComparison.lessThan(500000L));
   } catch (AssertionError e) {
     for (Entry<Thread, StackTraceElement[]> entry : Thread.getAllStackTraces().entrySet()) {
       new ThreadDumpException(entry.getKey(), entry.getValue()).printStackTrace(System.out);
     }
     throw e;
   }
 }