congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
IsNull
Code IndexAdd Tabnine to your IDE (free)

How to use
IsNull
in
org.hamcrest.core

Best Java code snippets using org.hamcrest.core.IsNull (Showing top 20 results out of 1,296)

Refine searchRefine arrow

  • Is
  • Node
  • IsEqual
  • IsInstanceOf
  • Session
  • Mockito
origin: google/j2objc

/**
 * A shortcut to the frequently used <code>not(nullValue())</code>.
 * <p/>
 * For example:
 * <pre>assertThat(cheese, is(notNullValue()))</pre>
 * instead of:
 * <pre>assertThat(cheese, is(not(nullValue())))</pre>
 */
public static org.hamcrest.Matcher<java.lang.Object> notNullValue() {
 return org.hamcrest.core.IsNull.notNullValue();
}
origin: google/j2objc

/**
 * Creates a matcher that matches if examined object is <code>null</code>.
 * <p/>
 * For example:
 * <pre>assertThat(cheese, is(nullValue())</pre>
 */
public static org.hamcrest.Matcher<java.lang.Object> nullValue() {
 return org.hamcrest.core.IsNull.nullValue();
}
origin: hamcrest/JavaHamcrest

/**
 * Creates a matcher that matches if examined object is <code>null</code>.
 * For example:
 * <pre>assertThat(cheese, is(nullValue())</pre>
 * 
 */
public static Matcher<Object> nullValue() {
  return new IsNull<Object>();
}
origin: ehcache/ehcache3

@Test
public void testTryWriteLockFailingClosesEntity() throws Exception {
 when(client.tryLock(WRITE)).thenReturn(false);
 when(entityRef.fetchEntity(null)).thenReturn(client);
 when(connection.<VoltronReadWriteLockClient, Void, Void>getEntityRef(VoltronReadWriteLockClient.class, 1, "VoltronReadWriteLock-TestLock")).thenReturn(entityRef);
 VoltronReadWriteLock lock = new VoltronReadWriteLock(connection, "TestLock");
 assertThat(lock.tryWriteLock(), nullValue());
 verify(client).close();
}
origin: ModeShape/modeshape

@Test
public void shouldParseDynamicOperandFromStringContainingReferenceValueOfSelector() {
  DynamicOperand operand = parser.parseDynamicOperand(tokens("REFERENCE(tableA)"), typeSystem, mock(Source.class));
  assertThat(operand, is(instanceOf(ReferenceValue.class)));
  ReferenceValue value = (ReferenceValue)operand;
  assertThat(value.selectorName(), is(selectorName("tableA")));
  assertThat(value.getPropertyName(), is(nullValue()));
}
origin: ehcache/ehcache3

@Test
public void testTryReadLockTryLocksRead() throws Exception {
 when(client.tryLock(READ)).thenReturn(true);
 when(entityRef.fetchEntity(null)).thenReturn(client);
 when(connection.<VoltronReadWriteLockClient, Void, Void>getEntityRef(VoltronReadWriteLockClient.class, 1, "VoltronReadWriteLock-TestLock")).thenReturn(entityRef);
 VoltronReadWriteLock lock = new VoltronReadWriteLock(connection, "TestLock");
 assertThat(lock.tryReadLock(), notNullValue());
 verify(client).tryLock(READ);
}
origin: mulesoft/mule

@Test
public void nullDeploymentClassLoaderAfterDispose() {
 ApplicationDescriptor descriptor = mock(ApplicationDescriptor.class);
 when(descriptor.getConfigResources()).thenReturn(emptySet());
 DefaultMuleApplication application =
   new DefaultMuleApplication(descriptor, mock(MuleApplicationClassLoader.class), emptyList(), null,
                 null, null, appLocation, null, null, null);
 application.install();
 assertThat(application.deploymentClassLoader, is(notNullValue()));
 application.dispose();
 assertThat(application.deploymentClassLoader, is(nullValue()));
}
origin: mulesoft/mule

@Test
public void transformerFactoryProperties() {
 SetPropertyAnswer setPropertyAnswer = new SetPropertyAnswer(transformerFactory);
 doAnswer(setPropertyAnswer).when(transformerFactoryWrapper).setAttribute(anyString(), anyObject());
 defaultXMLSecureFactories.configureTransformerFactory(transformerFactoryWrapper);
 assertThat(setPropertyAnswer.exception, is(nullValue()));
 for (String property : FACTORY_ATTRIBUTES) {
  verify(transformerFactoryWrapper).setAttribute(property, "");
 }
}
origin: ehcache/ehcache3

@Test
public void testGetAllWithLoaderException() throws Exception {
 when(cacheLoaderWriter.loadAll(ArgumentMatchers.<Iterable<Number>>any())).thenAnswer(invocation -> {
  @SuppressWarnings("unchecked")
  Iterable<Integer> iterable = (Iterable<Integer>) invocation.getArguments()[0];
  fail("expected BulkCacheLoadingException");
 } catch (BulkCacheLoadingException ex) {
  assertThat(ex.getFailures().size(), is(1));
  assertThat(ex.getFailures().get(2), is(notNullValue()));
  assertThat(ex.getSuccesses().size(), is(lessThan(4)));
  assertThat(ex.getSuccesses().containsKey(2), is(false));
origin: mulesoft/mule

@Test
public void testActionBeginOrJoinAndNoTx() throws Exception {
 MuleTransactionConfig config = new MuleTransactionConfig(TransactionConfig.ACTION_BEGIN_OR_JOIN);
 ExecutionTemplate executionTemplate = createExecutionTemplate(config);
 config.setFactory(new TestTransactionFactory(mockTransaction));
 Object result = executionTemplate.execute(getEmptyTransactionCallback());
 assertThat(result, is(RETURN_VALUE));
 verify(mockTransaction).commit();
 verify(mockTransaction, never()).rollback();
 assertThat(TransactionCoordination.getInstance().getTransaction(), IsNull.<Object>nullValue());
}
origin: ModeShape/modeshape

@Test
public void shouldImportIntoWorkspaceTheDocumentViewOfTheContentUsedInTckTests() throws Exception {
  Session session3 = repository.login();
  session.nodeTypeManager().registerNodeTypes(resourceStream("tck/tck_test_types.cnd"), true);
  session.getWorkspace().importXML("/",
                   resourceStream("tck/documentViewForTckTests.xml"),
                   ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING);
  assertThat(session.getRootNode().hasNode("testroot/workarea"), is(true));
  assertThat(session.getRootNode().getNode("testroot/workarea"), is(notNullValue()));
  assertThat(session.getNode("/testroot/workarea"), is(notNullValue()));
  assertNode("/testroot/workarea");
  Session session1 = repository.login();
  assertThat(session1.getRootNode().hasNode("testroot/workarea"), is(true));
  assertThat(session1.getRootNode().getNode("testroot/workarea"), is(notNullValue()));
  assertThat(session1.getNode("/testroot/workarea"), is(notNullValue()));
  session1.logout();
  assertThat(session3.getRootNode().hasNode("testroot/workarea"), is(true));
  assertThat(session3.getRootNode().getNode("testroot/workarea"), is(notNullValue()));
  assertThat(session3.getNode("/testroot/workarea"), is(notNullValue()));
  session3.logout();
}
origin: ModeShape/modeshape

@SuppressWarnings( "deprecation" )
public void testShouldCreateProperVersionHistoryWhenSavingVersionedNode() throws Exception {
  session = getHelper().getReadWriteSession();
  Node node = session.getRootNode().addNode("test", "nt:unstructured");
  node.addMixin("mix:versionable");
  session.save();
  assertThat(node.hasProperty("jcr:isCheckedOut"), is(true));
  assertThat(node.getProperty("jcr:isCheckedOut").getBoolean(), is(true));
  assertThat(node.hasProperty("jcr:versionHistory"), is(true));
  Node history = node.getProperty("jcr:versionHistory").getNode();
  assertThat(history, is(notNullValue()));
  assertThat(node.hasProperty("jcr:baseVersion"), is(true));
  Node version = node.getProperty("jcr:baseVersion").getNode();
  assertThat(version, is(notNullValue()));
  assertThat(version.getParent(), is(history));
  assertThat(node.hasProperty("jcr:uuid"), is(true));
  assertThat(node.getProperty("jcr:uuid").getString(), is(history.getProperty("jcr:versionableUuid").getString()));
  assertThat(versionHistory(node).getUUID(), is(history.getUUID()));
  assertThat(versionHistory(node).getIdentifier(), is(history.getIdentifier()));
  assertThat(versionHistory(node).getPath(), is(history.getPath()));
  assertThat(baseVersion(node).getUUID(), is(version.getUUID()));
  assertThat(baseVersion(node).getIdentifier(), is(version.getIdentifier()));
  assertThat(baseVersion(node).getPath(), is(version.getPath()));
}
origin: ModeShape/modeshape

@FixFor( "MODE-1089" )
public void testShouldNotFailGettingVersionHistoryForNodeMadeVersionableSinceLastSave() throws Exception {
  Session session1 = getHelper().getSuperuserSession();
  VersionManager vm = session1.getWorkspace().getVersionManager();
  // Create node structure
  Node root = session1.getRootNode();
  Node area = root.addNode("tmp2", "nt:unstructured");
  Node outer = area.addNode("outerFolder");
  Node inner = outer.addNode("innerFolder");
  Node file = inner.addNode("testFile.dat");
  file.setProperty("jcr:mimeType", "text/plain");
  file.setProperty("jcr:data", "Original content");
  session1.save();
  file.addMixin("mix:versionable");
  // session.save();
  isVersionable(vm, file); // here's the problem
  session1.save();
  Version v1 = vm.checkin(file.getPath());
  assertThat(v1, is(notNullValue()));
  // System.out.println("Created version: " + v1);
  // ubgraph(root.getNode("jcr:system/jcr:versionStorage"));
}
origin: ModeShape/modeshape

@Test
public void shouldFindMasterBranchAsPrimaryItemUnderTreeNode() throws Exception {
  Node git = gitRemoteNode();
  Node tree = git.getNode("tree");
  Item primaryItem = tree.getPrimaryItem();
  assertThat(primaryItem, is(notNullValue()));
  assertThat(primaryItem, is(instanceOf(Node.class)));
  Node primaryNode = (Node)primaryItem;
  assertThat(primaryNode.getName(), is("master"));
  assertThat(primaryNode.getParent(), is(sameInstance(tree)));
  assertThat(primaryNode, is(sameInstance(tree.getNode("master"))));
}
origin: ModeShape/modeshape

protected static void importContent( Node parent,
                   String resourceName,
                   int uuidBehavior ) throws RepositoryException, IOException {
  InputStream stream = resourceStream(resourceName);
  assertThat(stream, is(notNullValue()));
  parent.getSession().getWorkspace().importXML(parent.getPath(), stream, uuidBehavior);
}
origin: ModeShape/modeshape

@Test
public void shouldStartRepositoryUsingLocalEnvironmentWithDefaultPersistenceConfiguration() throws Exception {
  // Create the repository configuration ...
  String configFilePath = "config/repo-config-inmemory-no-persistence.json";
  InputStream configFileStream = getClass().getClassLoader().getResourceAsStream(configFilePath);
  RepositoryConfiguration repositoryConfiguration = RepositoryConfiguration.read(configFileStream, "doesn't matter");
  LocalEnvironment environment = new LocalEnvironment();
  repositoryConfiguration = repositoryConfiguration.with(environment);
  // Start the engine and repository ...
  ModeShapeEngine engine = new ModeShapeEngine();
  engine.start();
  try {
    JcrRepository repository = engine.deploy(repositoryConfiguration);
    Session session = repository.login();
    Node root = session.getRootNode();
    root.addNode("Library", "nt:folder");
    session.save();
    session.logout();
    session = repository.login();
    Node library = session.getNode("/Library");
    assertThat(library, is(notNullValue()));
    assertThat(library.getPrimaryNodeType().getName(), is("nt:folder"));
    session.logout();
  } finally {
    engine.shutdown().get();
    environment.shutdown();
  }
}
  
origin: neo4j/neo4j

@Test
public void shouldSerializeMapWithSimpleTypes() throws Exception
{
  MapRepresentation rep = new MapRepresentation( map( "nulls", null, "strings", "a string", "numbers", 42,
      "booleans", true ) );
  OutputFormat format = new OutputFormat( new JsonFormat(), new URI( "http://localhost/" ), null );
  String serializedMap = format.assemble( rep );
  Map<String, Object> map = JsonHelper.jsonToMap( serializedMap );
  assertThat( map.get( "nulls" ), is( nullValue() ) );
  assertThat( map.get( "strings" ), is( "a string" ) );
  assertThat( map.get( "numbers" ), is( 42 ) );
  assertThat( map.get( "booleans" ), is( true ) );
}
origin: mulesoft/mule

 @Test
 public void testTransactionalState() throws Exception {
  boolean shouldThrowException = resultMap.get(hasTransactionInContext).get(transactionConfig);
  Exception thrownException = null;
  CoreEvent result = null;
  if (hasTransactionInContext) {
   TransactionCoordination.getInstance().bindTransaction(mockTransaction);
  }
  ValidateTransactionalStateInterceptor<CoreEvent> interceptor =
    new ValidateTransactionalStateInterceptor<>(new ExecuteCallbackInterceptor<CoreEvent>(),
                          transactionConfig, false);
  try {
   result = interceptor.execute(() -> mockMuleEvent, new ExecutionContext());
  } catch (IllegalTransactionStateException e) {
   thrownException = e;
  }
  if (shouldThrowException) {
   assertThat(thrownException, notNullValue());
   assertThat(thrownException, instanceOf(IllegalTransactionStateException.class));
  } else {
   assertThat(result, is(mockMuleEvent));
  }
 }
}
origin: ModeShape/modeshape

@FixFor( "MODE-701" )
public void testShouldBeAbleToImportAutocreatedChildNodeWithoutDuplication() throws Exception {
  session = getHelper().getSuperuserSession();
  /*
  * Add a node that would satisfy the constraint
  */
  Node root = getTestRoot(session);
  Node parentNode = root.addNode("autocreatedChildRoot", "nt:unstructured");
  session.save();
  Node targetNode = parentNode.addNode("nodeWithAutocreatedChild", "modetest:nodeWithAutocreatedChild");
  assertThat(targetNode.getNode("modetest:autocreatedChild"), is(notNullValue()));
  // Don't save this yet
  session.refresh(false);
  InputStream in = getClass().getResourceAsStream("/io/autocreated-node-test.xml");
  session.importXML(root.getPath() + "/autocreatedChildRoot", in, ImportUUIDBehavior.IMPORT_UUID_COLLISION_THROW);
}
origin: ehcache/ehcache3

@SuppressWarnings({ "rawtypes", "unchecked" })
@Test
public void testRemoveAllWithWriterException() throws Exception {
 doAnswer(invocation -> {
  Iterable<Integer> iterable = (Iterable) invocation.getArguments()[0];
  Set<Integer> result = new HashSet<>();
  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));
org.hamcrest.coreIsNull

Javadoc

Is the value null?

Most used methods

  • notNullValue
    A shortcut to the frequently used not(nullValue(X.class)). Accepts a single dummy argument to facili
  • nullValue
    Creates a matcher that matches if examined object is null. Accepts a single dummy argument to facili
  • <init>

Popular in Java

  • Updating database using SQL prepared statement
  • getSharedPreferences (Context)
  • setRequestProperty (URLConnection)
  • setContentView (Activity)
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • String (java.lang)
  • Permission (java.security)
    Legacy security code; do not use.
  • Enumeration (java.util)
    A legacy iteration interface.New code should use Iterator instead. Iterator replaces the enumeration
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • 21 Best IntelliJ Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now