@Test public void setXBoundWithListParam_shouldSetXBoundParams() { //when TimePlot timePlot = createWidget(); timePlot.setXBound(Arrays.asList(lowerBound, upperBound)); //then assertThat(timePlot.getXLowerBound()).isGreaterThan(0); assertThat(timePlot.getXUpperBound()).isGreaterThan(0); assertThat(timePlot.getXAutoRange()).isFalse(); }
@Test public void setXBoundWithTwoDatesParams_shouldSetXBoundParams() { //when TimePlot timePlot = createWidget(); timePlot.setXBound(lowerBound, upperBound); //then assertThat(timePlot.getXLowerBound()).isGreaterThan(0); assertThat(timePlot.getXUpperBound()).isGreaterThan(0); assertThat(timePlot.getXAutoRange()).isFalse(); }
@Test public void testTimer() throws IOException, InterruptedException { Timer t = metricRegistry.timer(name("timer").tag("foo", "bar").build()); Timer.Context time = t.time(); Thread.sleep(1L); time.stop(); // We slept for 1Ms so we ensure that all timers are above 1ms: assertThat(registry.getSampleValue("timer_seconds", new String[]{"foo", "quantile"}, new String[]{"bar", "0.99"})).isGreaterThan(1 / 1000); assertThat(registry.getSampleValue("timer_seconds_count", new String[]{"foo"}, new String[]{"bar"})).isEqualTo(1); assertThat(registry.getSampleValue("timer_seconds_sum", new String[]{"foo"}, new String[]{"bar"})).isEqualTo(-1); assertThat(registry.getSampleValue("timer_meter_m1", new String[]{"foo"}, new String[]{"bar"})).isNotNull(); assertThat(registry.getSampleValue("timer_meter_total", new String[]{"foo"}, new String[]{"bar"})).isNotNull(); assertEquals(Double.valueOf(1.0D), registry.getSampleValue("timer_seconds_count", new String[]{"foo"}, new String[]{"bar"})); assertNotNull("Metric timer_seconds_count should exist", registry.getSampleValue("timer_seconds_count", new String[]{"foo"}, new String[]{"bar"})); assertTypeHelpTimer("timer"); }
assertThat(tableFinishInfo.getStatisticsWallTime().getValue(NANOSECONDS)).isGreaterThan(0); assertThat(tableFinishInfo.getStatisticsCpuTime().getValue(NANOSECONDS)).isGreaterThan(0);
assertThat(info.getStatisticsWallTime().getValue(NANOSECONDS)).isGreaterThan(0); assertThat(info.getStatisticsCpuTime().getValue(NANOSECONDS)).isGreaterThan(0);
private void assertDroppableTombstoneRatioPositive(String sstableMetadata) { Pattern pattern = Pattern.compile("Estimated droppable tombstones: ([0-9]*\\.[0-9]*)"); Matcher droppableTombstoneRatioMatcher = pattern.matcher(sstableMetadata); assertThat(droppableTombstoneRatioMatcher.find()) .as("SSTableMetadata output contains the droppable tombstone ratio") .isTrue(); assertThat(Double.parseDouble(droppableTombstoneRatioMatcher.group(1))).isGreaterThan(0); } }
@Test public void downSampledDistributionIsRepresentativeForReasonableData() { MultisetStatistics stats = new MultisetStatistics(); for (double number : LARGE_SAMPLE) { int elements = (int) (10 * PerformanceResults.DOWNSAMPLE_MAXIMUM_SIZE / (Math.abs(PerformanceResults.DOWNSAMPLE_MAXIMUM_SIZE - number) + 1)); stats.addValue(number, elements); } Mockito.when(mockResult.getStatistics()).thenReturn(stats); List<Double> downSampledData = PerformanceResults.getData(mockRunResult); MultisetStatistics downSampledStats = new MultisetStatistics(); for (double number : downSampledData) { downSampledStats.addValue(number, 1); } // Hypothesis that means are the same cannot be rejected with confidence more than 0.5 assertThat(TestUtils.tTest(stats, downSampledStats, 1 - 0.5)).isEqualTo(false); // The typical p value is 0.05, but I went with 0.5 because I can assertThat(TestUtils.homoscedasticTTest(stats, downSampledStats)).isGreaterThan(0.5d); }
@Step public void should_see_product_rating() { assertThat(listingPage.getRating()).isGreaterThan(0); }
@Test void testSystemMetrics() throws InterruptedException { systemMetrics.bindTo(metricRegistry); // makes sure system.cpu.total.norm.pct does not return NaN consumeCpu(); Thread.sleep(1000); assertThat(metricRegistry.get("system.cpu.total.norm.pct", Collections.emptyMap())).isBetween(0.0, 1.0); assertThat(metricRegistry.get("system.process.cpu.total.norm.pct", Collections.emptyMap())).isBetween(0.0, 1.0); assertThat(metricRegistry.get("system.memory.total", Collections.emptyMap())).isGreaterThan(0.0); assertThat(metricRegistry.get("system.memory.actual.free", Collections.emptyMap())).isGreaterThan(0.0); assertThat(metricRegistry.get("system.process.memory.size", Collections.emptyMap())).isGreaterThan(0.0); }
@CsvMethod public void assertBiggerThan(String value, String... identifier) { GwtInstance gwtInstance = object(identifier); Object actual = gwtInstance.getRaw(); if (actual == null) { fail(prefix() + "number is null: " + gwtInstance.identifierToString()); } else if (actual instanceof Integer) { assertThat((Integer) actual).as(prefix() + "Integer").isGreaterThan( Integer.parseInt(value)); } else if (actual instanceof Long) { assertThat((Long) actual).as(prefix() + "Long").isGreaterThan(Long.parseLong(value)); } else if (actual instanceof Double) { assertThat((Double) actual).as(prefix() + "Double").isGreaterThan( Double.parseDouble(value)); } else if (actual instanceof Float) { assertThat((Float) actual).as(prefix() + "Float").isGreaterThan(Float.parseFloat(value)); } else { fail(prefix() + "cannot compare object of type " + actual.getClass().getName() + " to <" + value + ">"); } }
@Test public void testComputation() { JsonObject json = new JsonObject() .put("name", "test") .put("symbol", "TT"); MarketDataVerticle verticle = new MarketDataVerticle(); verticle.init(json); int volume = verticle.stocks; assertThat(verticle.ask).isGreaterThan(0.0); assertThat(verticle.bid).isGreaterThan(0.0); assertThat(verticle.share).isGreaterThanOrEqualTo(0).isLessThanOrEqualTo(volume); for (int i = 0; i < 1000000; i++) { verticle.compute(); assertThat(verticle.ask).isGreaterThan(0.0); assertThat(verticle.bid).isGreaterThan(0.0); assertThat(verticle.share).isGreaterThanOrEqualTo(0).isLessThanOrEqualTo(volume); } }
@Test void testGetAllocatedBytes() { final double snapshot = JvmGcMetrics.HotspotAllocationSupplier.INSTANCE.get(); assertThat(snapshot).isPositive(); new Object(); assertThat(JvmGcMetrics.HotspotAllocationSupplier.INSTANCE.get()).isGreaterThan(snapshot); } }
@Step public void should_see_total_including_shipping_for(ListingItem selectedItem) { OrderCostSummary orderCostSummary = cartPage.getOrderCostSummaryFor(selectedItem).get(); double itemTotal = orderCostSummary.getItemTotal(); double shipping = orderCostSummary.getShipping(); assertThat(itemTotal).isEqualTo(selectedItem.getPrice()); assertThat(shipping).isGreaterThan(0.0); }
JsonObject quote = (JsonObject) message.body(); System.out.println(quote.encodePrettily()); assertThat(quote.getDouble("bid")).isGreaterThan(0); assertThat(quote.getDouble("ask")).isGreaterThan(0); assertThat(quote.getInteger("volume")).isGreaterThan(0); assertThat(quote.getInteger("shares")).isGreaterThan(0); switch (quote.getString("symbol")) { case "MCH":
@Test public void test16ThreadsRateLimit20() throws ExecutionException, InterruptedException { Meter rate = new Meter(); Histogram avgRetries = new Histogram(new ExponentiallyDecayingReservoir()); int rateLimit = 20; List<ListenableFuture<?>> tasks = createWorkers(rate, avgRetries, 16, rateLimit, Duration.ofMillis(50)) .map(executorService::submit) .collect(Collectors.toList()); ListenableFuture<?> task = Futures.allAsList(tasks); Instant start = Instant.now(); while (!task.isDone()) { sleep(1000); log.info("Average rate is {}, 1 minute rate is {}", rate.getMeanRate(), rate.getOneMinuteRate()); log.info("Average number of retries is {}, max is {}", avgRetries.getSnapshot().getMean(), avgRetries.getSnapshot().getMax()); if (Duration.between(start, Instant.now()).compareTo(GRACE) > 0) { assertThat(rate.getMeanRate()).isGreaterThan(0.75 * rateLimit); } } task.get(); }
assertThat(tableFinishInfo.getStatisticsWallTime().getValue(NANOSECONDS)).isGreaterThan(0); assertThat(tableFinishInfo.getStatisticsCpuTime().getValue(NANOSECONDS)).isGreaterThan(0);
assertThat(tableFinishInfo.getStatisticsWallTime().getValue(NANOSECONDS)).isGreaterThan(0); assertThat(tableFinishInfo.getStatisticsCpuTime().getValue(NANOSECONDS)).isGreaterThan(0);
assertThat(info.getStatisticsWallTime().getValue(NANOSECONDS)).isGreaterThan(0); assertThat(info.getStatisticsCpuTime().getValue(NANOSECONDS)).isGreaterThan(0);
assertThat(info.getStatisticsWallTime().getValue(NANOSECONDS)).isGreaterThan(0); assertThat(info.getStatisticsCpuTime().getValue(NANOSECONDS)).isGreaterThan(0);