Verifier assertThatLeakValueIs(Metric metric, Rating expectedRating) { TestContext context = run(metric, true); assertThat(context.ratingLeakValue).isNotNull().isEqualTo(expectedRating); return this; }
Verifier assertThatValueIs(Metric metric, Rating expectedValue) { TestContext context = run(metric, false); assertThat(context.ratingValue).isNotNull().isEqualTo(expectedValue); return this; }
@Test @SuppressWarnings("deprecation") public void backwardCompatibility() { assertThat(SerializationFormat.ofThrift()).containsExactlyInAnyOrder(BINARY, COMPACT, JSON, TEXT); assertThat(SerializationFormat.THRIFT_BINARY).isNotNull(); assertThat(SerializationFormat.THRIFT_COMPACT).isNotNull(); assertThat(SerializationFormat.THRIFT_JSON).isNotNull(); assertThat(SerializationFormat.THRIFT_TEXT).isNotNull(); }
public IntentAssert hasComponent(ComponentName expected) { isNotNull(); ComponentName componentName = actual.getComponent(); assertThat(componentName).isNotNull() .overridingErrorMessage("Expected component name <%s> but was <%s>.", expected.flattenToString(), componentName.flattenToString()) .isEqualTo(expected); return this; }
@Test public void createLegendPositionByEmptyConstructor_hasPositionIsNotNull() { //then Assertions.assertThat(legendPosition.getPosition()).isNotNull(); }
@Test public void testObjectSerialization() throws IOException, ClassNotFoundException { final Calendar now = Calendar.getInstance(); assertThat(now).isNotNull(); final byte[] nowBytes = IOUtils.serializeObject(now); assertThat(nowBytes).isNotNull(); assertThat(nowBytes.length != 0).isTrue(); final Object nowObj = IOUtils.deserializeObject(nowBytes); assertThat(nowObj).isInstanceOf(Calendar.class); assertThat(((Calendar) nowObj).getTimeInMillis()).isEqualTo(now.getTimeInMillis()); }
private void validateChunkSizes(OffHeapStoredObject c, int dataSize) { assertThat(c).isNotNull(); assertThat(c.getDataSize()).isEqualTo(dataSize); assertThat(c.getSize()).isEqualTo(computeExpectedSize(dataSize)); }
@Test public void load_version_from_file_in_classpath() { Version version = ApiVersion.load(System2.INSTANCE); assertThat(version).isNotNull(); assertThat(version.major()).isGreaterThanOrEqualTo(5); }
@Test public void createHeatMapByEmptyConstructor_hasLegendPositionAndLayoutAreNotNulls() { //when HeatMap heatMap = createWidget(); //then assertThat(heatMap.getLegendPosition()).isNotNull(); assertThat(heatMap.getLegendLayout()).isNotNull(); }
@Test public void testCompletionContainsOnlyLog4jLevels() { LogLevelConverter converter = new LogLevelConverter(); List<Completion> completions = new ArrayList<>(); converter.getAllPossibleValues(completions, null, null, null, null); assertThat(completions.size()).isEqualTo(8); for (Completion completion : completions) { String level = completion.getValue(); assertThat(Level.getLevel(level)).isNotNull(); } } }
@Test public void createHistogramByEmptyConstructor_hasDisplayModeIsNotNull() { //given histogram = createWidget(); //then assertThat(histogram.getDisplayMode()).isNotNull(); }
/** * Validate the "Content-Type" header of the specified response. * @param response the response * @param expected the expected result */ protected void validateContentType(ResponseEntity<String> response, MediaType expected) { MediaType actual = response.getHeaders().getContentType(); assertThat(actual).isNotNull(); assertThat(actual.isCompatibleWith(expected)) .as("Non compatible media-type, expected " + expected + ", got " + actual) .isTrue(); }
private void assertAsyncEventQueueDetails( final Set<DiskStoreDetails.AsyncEventQueueDetails> expectedAsyncEventQueueDetailsSet, final DiskStoreDetails diskStoreDetails) { int actualCount = 0; for (final DiskStoreDetails.AsyncEventQueueDetails actualAsyncEventQueueDetails : diskStoreDetails .iterateAsyncEventQueues()) { final DiskStoreDetails.AsyncEventQueueDetails expectedAsyncEventQueueDetails = CollectionUtils .findBy(expectedAsyncEventQueueDetailsSet, asyncEventQueueDetails -> ObjectUtils .equals(asyncEventQueueDetails.getId(), actualAsyncEventQueueDetails.getId())); assertThat(expectedAsyncEventQueueDetails).isNotNull(); actualCount++; } assertThat(actualCount).isEqualTo(expectedAsyncEventQueueDetailsSet.size()); }
@Test public void testRemovingExecutor() throws Exception { final Executor executor = this.executorDao.addExecutor("localhost1", 12345); assertThat(executor).isNotNull(); this.executorDao.removeExecutor("localhost1", 12345); final Executor fetchedExecutor = this.executorDao.fetchExecutor("localhost1", 12345); assertThat(fetchedExecutor).isNull(); }
@Test public void testCreateParametersUsingDataProviderNegativeCase() { XmlTest xmlTest = createXmlTest("suite", "test"); Class<?> clazz = ExceptionThrowingDataDrivenSampleTestClass.class; ITestNGMethod testNGMethod = new FakeTestNGMethod(clazz, "testMethod", xmlTest); ParameterHandler.ParameterBag params = invokeParameterCreation(testNGMethod); assertThat(params.parameterHolder).isNull(); assertThat(params.errorResult).isNotNull(); assertThat(params.errorResult.getThrowable()) .hasCauseInstanceOf(UnsupportedOperationException.class); }
@Test public void createPointsByEmptyConstructor_hasSizeAndShapeIsNotNull() { //when Points points = new Points(); //then Assertions.assertThat(points.getSize()).isNotNull(); Assertions.assertThat(points.getShape()).isNotNull(); }
@Test public void createStemsByEmptyConstructor_hasWidthAndStyleAreNotNulls() { //when Stems stems = new Stems(); //then Assertions.assertThat(stems.getWidth()).isNotNull(); Assertions.assertThat(stems.getStyle()).isNotNull(); }
private void assertGatewayDetails( final Set<DiskStoreDetails.GatewayDetails> expectedGatewayDetailsSet, final DiskStoreDetails diskStoreDetails) { int actualCount = 0; for (final DiskStoreDetails.GatewayDetails actualGatewayDetails : diskStoreDetails .iterateGateways()) { DiskStoreDetails.GatewayDetails expectedGatewayDetails = CollectionUtils.findBy(expectedGatewayDetailsSet, gatewayDetails -> ObjectUtils .equals(gatewayDetails.getId(), actualGatewayDetails.getId())); assertThat(expectedGatewayDetails).isNotNull(); assertThat(actualGatewayDetails.isPersistent()) .isEqualTo(expectedGatewayDetails.isPersistent()); actualCount++; } assertThat(actualCount).isEqualTo(expectedGatewayDetailsSet.size()); }
@Config(sdk = 18) @Test public void testAlarmAfterReboot() { // rebooting should update widget again via update broadcast widgetProvider.onReceive(RuntimeEnvironment.application, new Intent(AppWidgetManager.ACTION_APPWIDGET_UPDATE) .putExtra(AppWidgetManager.EXTRA_APPWIDGET_IDS, new int[]{appWidgetId})); assertThat(shadowOf(alarmManager).getNextScheduledAlarm()).isNotNull(); widgetProvider.onDeleted(RuntimeEnvironment.application, new int[]{appWidgetId}); assertThat(shadowOf(alarmManager).getNextScheduledAlarm()).isNull(); }
@Config(sdk = 18) @Test public void testDeleteCancelAlarm() { new WidgetHelper(RuntimeEnvironment.application).configure(appWidgetId); assertThat(shadowOf(alarmManager).getNextScheduledAlarm()).isNotNull(); widgetProvider.onDeleted(RuntimeEnvironment.application, new int[]{appWidgetId}); assertThat(shadowOf(alarmManager).getNextScheduledAlarm()).isNull(); }