本文整理了Java中org.hamcrest.core.IsNull.notNullValue()
方法的一些代码示例,展示了IsNull.notNullValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IsNull.notNullValue()
方法的具体详情如下:
包路径:org.hamcrest.core.IsNull
类名称:IsNull
方法名:notNullValue
[英]A shortcut to the frequently used not(nullValue())
.
For example:
assertThat(cheese, is(notNullValue()))
instead of:
assertThat(cheese, is(not(nullValue())))
[中]常用not(nullValue())
的快捷方式。
例如:
assertThat(cheese, is(notNullValue()))
而不是:
assertThat(cheese, is(not(nullValue())))
代码示例来源:origin: auth0/java-jwt
@Test
public void shouldReturnNonNullClaimWhenParsingArray() throws Exception {
JsonNode value = mapper.valueToTree(new String[]{});
Claim claim = claimFromNode(value);
assertThat(claim, is(notNullValue()));
assertThat(claim, is(instanceOf(JsonNodeClaim.class)));
assertThat(claim.isNull(), is(false));
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
@TestForIssue(jiraKey = "HHH-11651")
public void testUnwrappingAbstractMultiTenantConnectionProvider() {
final MultiTenantConnectionProvider multiTenantConnectionProvider = serviceRegistry.getService(
MultiTenantConnectionProvider.class );
final AbstractMultiTenantConnectionProvider connectionProvider = multiTenantConnectionProvider.unwrap(
AbstractMultiTenantConnectionProvider.class );
assertThat( connectionProvider, is( notNullValue() ) );
}
代码示例来源:origin: hamcrest/JavaHamcrest
@Test public void
supportsMixedTypes() {
final Matcher<SampleSubClass> matcher = allOf(
equalTo(new SampleBaseClass("bad")),
is(notNullValue()),
equalTo(new SampleBaseClass("good")),
equalTo(new SampleSubClass("ugly")));
assertDoesNotMatch("didn't fail last sub-matcher", matcher, new SampleSubClass("good"));
}
代码示例来源:origin: neo4j/neo4j
@Test
public void shouldCloseTransactionsWhenIteratingResults()
{
// Given an execution result that has been started but not exhausted
createNode();
createNode();
Result executionResult = db.execute( "CYPHER runtime=interpreted MATCH (n) RETURN n" );
executionResult.next();
assertThat( activeTransaction(), is( notNullValue() ) );
// When
executionResult.close();
// Then
assertThat( activeTransaction(), is( nullValue() ) );
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public void execute(DelegateExecution execution) throws Exception {
assertThat(execution.getVariableLocal("targetOrderId"),is(notNullValue()));
}
}
代码示例来源:origin: mulesoft/mule
protected void assertArtifactIsNotRegisteredAsZombie(String artifactName, Map<String, Map<URI, Long>> zombieMap) {
if (zombieMap.containsKey(artifactName)) {
Map.Entry<URI, Long> zombieEntry =
getZombieFromMap((entry) -> new File((URI) entry.getKey()).getName().equals(artifactName), zombieMap);
assertThat("Artifact tagged as zombie.", zombieEntry, is(notNullValue()));
}
}
代码示例来源:origin: auth0/java-jwt
@Test
public void shouldReturnNonNullClaimWhenParsingIntValue() throws Exception {
JsonNode value = mapper.valueToTree(Integer.MAX_VALUE);
Claim claim = claimFromNode(value);
assertThat(claim, is(notNullValue()));
assertThat(claim, is(instanceOf(JsonNodeClaim.class)));
assertThat(claim.isNull(), is(false));
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
@TestForIssue(jiraKey = "HHH-11651")
public void testUnwrappingMultiTenantConnectionProvider() {
final MultiTenantConnectionProvider multiTenantConnectionProvider = serviceRegistry.getService(
MultiTenantConnectionProvider.class );
final MultiTenantConnectionProvider connectionProvider = multiTenantConnectionProvider.unwrap(
MultiTenantConnectionProvider.class );
assertThat( connectionProvider, is( notNullValue() ) );
}
}
代码示例来源:origin: mulesoft/mule
@Test
public void findDomainApplicationsWillNonExistentDomainReturnsEmptyCollection() {
Collection<Application> domainApplications = deploymentService.findDomainApplications("");
assertThat(domainApplications, notNullValue());
assertThat(domainApplications.isEmpty(), is(true));
}
代码示例来源:origin: neo4j/neo4j
@Test
public void shouldCloseTransactionsWhenIteratingOverSingleColumn()
{
// Given an execution result that has been started but not exhausted
createNode();
createNode();
Result executionResult = db.execute( "CYPHER runtime=interpreted MATCH (n) RETURN n" );
ResourceIterator<Node> resultIterator = executionResult.columnAs( "n" );
resultIterator.next();
assertThat( activeTransaction(), is( notNullValue() ) );
// When
resultIterator.close();
// Then
assertThat( activeTransaction(), is( nullValue() ) );
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public void notify(DelegateExecution execution) {
execution.setVariable("varName", "varValue", "activityId");
assertThat(execution.getVariableLocal("varName"), is(notNullValue()));
}
代码示例来源:origin: mulesoft/mule
protected void assertArtifactIsRegisteredAsZombie(String artifactName, Map<String, Map<URI, Long>> zombieMap) {
assertEquals("Wrong number of zombie artifacts registered.", 1, zombieMap.size());
if (!zombieMap.containsKey(artifactName)) {
Map.Entry<URI, Long> zombieEntry =
getZombieFromMap((entry) -> new File((URI) entry.getKey()).getName().equals(artifactName), zombieMap);
assertThat("Wrong URL tagged as zombie.", zombieEntry, is(notNullValue()));
}
}
代码示例来源:origin: auth0/java-jwt
@Test
public void shouldReturnNonNullClaimWhenParsingBooleanValue() throws Exception {
JsonNode value = mapper.valueToTree(Boolean.TRUE);
Claim claim = claimFromNode(value);
assertThat(claim, is(notNullValue()));
assertThat(claim, is(instanceOf(JsonNodeClaim.class)));
assertThat(claim.isNull(), is(false));
}
}
代码示例来源:origin: hibernate/hibernate-orm
@Test
@TestForIssue( jiraKey = "HHH-11651")
public void testUnwrappingConnectionProvider() {
final MultiTenantConnectionProvider multiTenantConnectionProvider = serviceRegistry.getService(
MultiTenantConnectionProvider.class );
final ConnectionProvider connectionProvider = multiTenantConnectionProvider.unwrap( ConnectionProvider.class );
assertThat( connectionProvider, is( notNullValue() ) );
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void shouldPointToItself() {
// given
testRule.deploy(CALLED_PROCESS);
// when
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(CALLED_PROCESS_KEY);
// assume
assertThat(processInstance.getRootProcessInstanceId(), notNullValue());
// then
assertThat(processInstance.getRootProcessInstanceId(), is(processInstance.getProcessInstanceId()));
}
代码示例来源:origin: facebook/litho
@Test
public void testMatcherFailureMessage() {
final TestBaseMatcher matcher =
new TestBaseMatcher().clickHandler(IsNull.<EventHandler<ClickEvent>>notNullValue(null));
final Condition<InspectableComponent> condition =
BaseMatcherBuilder.buildCommonMatcher(matcher);
condition.matches(mInspectableComponent);
assertThat(condition.description().toString())
.isEqualTo("Click handler <not null> (doesn't match <null>)");
}
代码示例来源:origin: camunda/camunda-bpm-platform
@Override
public void execute(DelegateExecution execution) {
execution.setVariable("varName", "varValue", "activityId");
assertThat(execution.getVariableLocal("varName"), is(notNullValue()));
}
代码示例来源:origin: auth0/java-jwt
@Test
public void shouldReturnNonNullClaimWhenParsingList() throws Exception {
JsonNode value = mapper.valueToTree(new ArrayList<String>());
Claim claim = claimFromNode(value);
assertThat(claim, is(notNullValue()));
assertThat(claim, is(instanceOf(JsonNodeClaim.class)));
assertThat(claim.isNull(), is(false));
}
代码示例来源:origin: ehcache/ehcache3
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testRemoveAllWithWriterException() throws Exception {
doAnswer(invocation -> {
fail("expected CacheWritingException");
} catch (BulkCacheWritingException ex) {
assertThat(ex.getFailures().size(), is(1));
assertThat(ex.getFailures().get(2), is(notNullValue()));
assertThat(ex.getSuccesses().size(), is(3));
assertThat(ex.getSuccesses().containsAll(Arrays.asList(1, 3, 4)), is(true));
代码示例来源:origin: camunda/camunda-bpm-platform
@Test
public void shouldPointToItselfBySubmittingStartForm() {
// given
DeploymentWithDefinitions deployment = testRule.deploy(CALLED_PROCESS);
String processDefinitionId = deployment.getDeployedProcessDefinitions().get(0).getId();
Map<String, Object> properties = new HashMap<>();
// when
ProcessInstance processInstance = formService.submitStartForm(processDefinitionId, properties);
// assume
assertThat(processInstance.getRootProcessInstanceId(), notNullValue());
// then
assertThat(processInstance.getRootProcessInstanceId(), is(processInstance.getProcessInstanceId()));
}
内容来源于网络,如有侵权,请联系作者删除!