org.assertj.core.api.AbstractMapAssert.isNotNull()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.1k)|赞(0)|评价(0)|浏览(88)

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

AbstractMapAssert.isNotNull介绍

暂无

代码示例

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Use the given {@link Function} to extract a value from the {@link Map}'s entries.
 * The extracted values are stored in a new list becoming the object under test.
 * <p>
 * Let's take a look at an example to make things clearer :
 *  <pre><code class='java'> // Build a Map that associates family roles and name of the Simpson familly
 * Map&lt;String, CartoonCharacter&gt; characters = new HashMap&lt;&gt;();
 * characters.put(&quot;dad&quot;, new CartoonCharacter(&quot;Omer&quot;));
 * characters.put(&quot;mom&quot;, new CartoonCharacter(&quot;Marge&quot;));
 * characters.put(&quot;girl&quot;, new CartoonCharacter(&quot;Lisa&quot;));
 * characters.put(&quot;boy&quot;, new CartoonCharacter(&quot;Bart&quot;));
 *
 * assertThat(characters).extractingFromEntries(e -&gt; e.getValue().getName())
 *                       .containsOnly(&quot;Omer&quot;, &quot;Marge&quot;, &quot;Lisa&quot;, &quot;Bart&quot;);</code></pre>
 *
 * @param extractor the extractor function to extract a value from an entry of the Map under test.
 * @return a new assertion object whose object under test is the list of values extracted
 * @since 3.12.0
 */
@CheckReturnValue
public AbstractListAssert<?, List<?>, Object, ObjectAssert<Object>> extractingFromEntries(Function<? super Map.Entry<K, V>, Object> extractor) {
 isNotNull();
 List<Object> extractedObjects = actual.entrySet().stream()
                    .map(extractor::apply)
                    .collect(toList());
 return newListAssertInstance(extractedObjects).as(info.description());
}

代码示例来源:origin: joel-costigliola/assertj-core

isNotNull();

代码示例来源:origin: org.assertj/assertj-core

isNotNull();
List<Object> extractedValues = Stream.of(keys).map(actual::get).collect(Collectors.toList());
String extractedPropertiesOrFieldsDescription = extractedDescriptionOf(keys);

代码示例来源:origin: joel-costigliola/assertj-core

isNotNull();
List<Object> extractedValues = Stream.of(keys).map(actual::get).collect(Collectors.toList());
String extractedPropertiesOrFieldsDescription = extractedDescriptionOf(keys);

代码示例来源:origin: s0h4m/toggle

private void assertValidConfig(Config config) {
  assertThat(config.getFeatureMap()).isNotNull();
  assertThat(config.getFeatureMap().get("video")).isNotNull();
  assertThat(config.getFeatureMap().get("audio")).isNotNull();
  assertThat(config.getFeatureMap().get("speech")).isNotNull();
  assertThat(config.getFeatureMap().get("random")).isNull();
}

代码示例来源:origin: TNG/junit-dataprovider

@Test
public void testGetDataProviderMethodShouldInitializeMapUsedForCaching() {
  // Given:
  doReturn(null).when(testMethod).getAnnotation(UseDataProvider.class);
  underTest.dataProviderMethods = null;
  // When:
  underTest.getDataProviderMethods(testMethod);
  // Then:
  assertThat(underTest.dataProviderMethods).isNotNull();
}

代码示例来源:origin: apache/archiva

assertThat( props ).isNotNull().doesNotContainKey( "deleteKey" );

代码示例来源:origin: segmentio/analytics-android

@Test
public void projectSettings() throws Exception {
 @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
 ValueMap valueMap = new ValueMap(cartographer.fromJson(PROJECT_SETTINGS_JSON_SAMPLE));
 assertThat(valueMap.getValueMap("Amplitude"))
   .isNotNull()
   .hasSize(4)
   .contains(MapEntry.entry("apiKey", "ad3c426eb736d7442a65da8174bc1b1b"))
   .contains(MapEntry.entry("trackNamedPages", true))
   .contains(MapEntry.entry("trackCategorizedPages", true))
   .contains(MapEntry.entry("trackAllPages", false));
 assertThat(valueMap.getValueMap("Flurry"))
   .isNotNull()
   .hasSize(4)
   .contains(MapEntry.entry("apiKey", "8DY3D6S7CCWH54RBJ9ZM"))
   .contains(MapEntry.entry("captureUncaughtExceptions", false))
   .contains(MapEntry.entry("useHttps", true))
   .contains(MapEntry.entry("sessionContinueSeconds", 10.0));
}

相关文章