public LruCacheAssert<K, V> hasEntry(K key) { isNotNull(); assertThat(actual.snapshot()) // .overridingErrorMessage("Expected to contain entry with key <%s> but did not.") // .containsKey(key); return this; }
public LruCacheAssert<K, V> hasEntry(K key) { isNotNull(); assertThat(actual.snapshot()) // .overridingErrorMessage("Expected to contain entry with key <%s> but did not.") // .containsKey(key); return this; }
public LruCacheAssert<K, V> hasEntry(K key) { isNotNull(); assertThat(actual.snapshot()) // .overridingErrorMessage("Expected to contain entry with key <%s> but did not.") // .containsKey(key); return this; }
@Test public void type() { for (Builder builder : builders) { BasePayload payload = builder.userId("user_id").build(); assertThat(payload.type()) .isIn(Type.alias, Type.track, Type.screen, Type.group, Type.identify); assertThat(payload).containsKey(BasePayload.TYPE_KEY); } }
@Test public void timestamp() { Date timestamp = new Date(); for (Builder builder : builders) { BasePayload payload = builder.userId("user_id").timestamp(timestamp).build(); assertThat(payload.timestamp()).isEqualTo(timestamp); assertThat(payload).containsKey(BasePayload.TIMESTAMP_KEY); } }
@Test public void messageIdIsGenerated() { for (Builder builder : builders) { BasePayload payload = builder.userId("user_id").build(); assertThat(payload.messageId()).isNotEmpty(); assertThat(payload).containsKey(BasePayload.MESSAGE_ID); } }
@Test public void testExplodeTestMethodsUseDataProviderShouldReturnFrameworkMethodInjectedToUseDataProviderMethodIfExists() throws Throwable { // Given: final Method method = getMethod("dataProviderMethod"); doReturn(method).when(dataProviderMethod).getMethod(); List<Object[]> dataConverterResult = listOfArrays(new Object[] { null }); doReturn(dataConverterResult).when(dataConverter).convert(any(), anyBoolean(), any(Class[].class), any(DataProvider.class)); doReturn(dataProvider).when(dataProviderMethod).getAnnotation(DataProvider.class); doReturn(DataProvider.DEFAULT_FORMAT).when(dataProvider).format(); doReturn(true).when(dataProvider).cache(); // When: List<FrameworkMethod> result = underTest.explodeTestMethod(testMethod, dataProviderMethod); // Then: assertThat(TestGenerator.dataProviderDataCache).hasSize(1).containsKey(dataProviderMethod); assertThat(result).hasSize(1); verify(dataProviderMethod).invokeExplosively(null, testMethod); }
context = AnalyticsContext.create(RuntimeEnvironment.application, traits, true); .containsKey("app") // .containsKey("device") // .containsKey("library") // .containsKey("locale") // .containsKey("network") // .containsKey("os") // .containsKey("screen") .containsEntry("userAgent", "undefined") // .containsKey("timezone") // value depends on where the tests are run .containsKey("traits");
@Test public void customJsonMapDeserialization() throws Exception { Settings settings = new Settings(cartographer.fromJson(PROJECT_SETTINGS_JSON_SAMPLE)); assertThat(settings) .hasSize(4) .containsKey("Amplitude") .containsKey("Segment") .containsKey("Flurry") .containsKey("Mixpanel"); // Map Constructor MixpanelSettings mixpanelSettings = settings.getMixpanelSettings(); assertThat(mixpanelSettings) // .contains(MapEntry.entry("token", "f7afe0cb436685f61a2b203254779e02")) .contains(MapEntry.entry("people", true)) .contains(MapEntry.entry("trackNamedPages", true)) .contains(MapEntry.entry("trackCategorizedPages", true)) .contains(MapEntry.entry("trackAllPages", false)); try { settings.getAmplitudeSettings(); } catch (AssertionError exception) { assertThat(exception) // .hasMessage( "Could not create instance of com.segment.analytics.ValueMapTest.AmplitudeSettings.\n" + "java.lang.NoSuchMethodException: " + "com.segment.analytics.ValueMapTest$AmplitudeSettings.<init>(java.util.Map)"); } }
ProjectSettings.create(cartographer.fromJson(projectSettingsJson)); assertThat(projectSettings).hasSize(5).containsKey("timestamp").containsKey("Segment.io");
@Test public void logoutClearsTraitsAndUpdatesContext() { analyticsContext.setTraits(new Traits().putAge(20).putAvatar("bar")); analytics.logout(); verify(traitsCache).delete(); verify(traitsCache) .set( argThat( new TypeSafeMatcher<Traits>() { @Override protected boolean matchesSafely(Traits traits) { return !isNullOrEmpty(traits.anonymousId()); } @Override public void describeTo(Description description) {} })); assertThat(analyticsContext.traits()).hasSize(1).containsKey("anonymousId"); }
/** * Validates that the row-level access definition is properly exposed when set on a table. * * @jira_ticket JAVA-1335 * @test_category metadata */ @Test(groups = "short") public void should_show_RLAC_for_table() throws Exception { session() .execute( String.format( "CREATE TABLE %s.reports (\n" + " report_user text,\n" + " report_number int,\n" + " report_month int,\n" + " report_year int,\n" + " report_text text,\n" + " PRIMARY KEY (report_user, report_number)\n" + ");", keyspace)); String rlacCql = String.format("RESTRICT ROWS ON %s.reports USING report_user;", keyspace); session().execute(rlacCql); TableMetadata table = cluster().getMetadata().getKeyspace(keyspace).getTable("reports"); assertThat(table.getOptions().getExtensions()).containsKey("DSE_RLACA"); assertThat(table.exportAsString()).contains(rlacCql); }
MaterializedViewMetadata mv = cluster().getMetadata().getKeyspace(keyspace).getMaterializedView("reports_by_year"); assertThat(mv.getOptions().getExtensions()).containsKey("DSE_RLACA"); assertThat(mv.exportAsString()).contains(rlacCql);