IsNull
Code IndexAdd Codota to your IDE (free)

Best code snippets using org.hamcrest.core.IsNull(Showing top 20 results out of 513)

Refine search

  • Is
  • Node
  • IsEqual
  • IsInstanceOf
  • Session
  • Mockito
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: neo4j/neo4j

@SuppressWarnings( "unchecked" )
private <T extends PropertyContainer> void makeSureAdditionsCanBeRead(
    Index<T> index, EntityCreator<T> entityCreator )
{
  String key = "name";
  String value = "Mattias";
  assertThat( index.get( key, value ).getSingle(), is( nullValue() ) );
  assertThat( index.get( key, value ), emptyIterable() );
  assertThat( index.query( key, "*" ), emptyIterable() );
  T entity1 = entityCreator.create();
  T entity2 = entityCreator.create();
  index.add( entity1, key, value );
  for ( int i = 0; i < 2; i++ )
  {
    assertThat( index.get( key, value ), Contains.contains( entity1 ) );
    assertThat( index.query( key, "*" ), Contains.contains( entity1 ) );
    assertThat( index.get( key, value ), Contains.contains( entity1 ) );
    restartTx();
  }
  index.add( entity2, key, value );
  assertThat( index.get( key, value ), Contains.contains( entity1, entity2 ) );
  restartTx();
  assertThat( index.get( key, value ), Contains.contains( entity1, entity2 ) );
  index.delete();
}
origin: neo4j/neo4j

@Test
public void shouldSerializeMapWithMapsOfSimpleTypes() throws Exception
{
  MapRepresentation rep = new MapRepresentation( map( "maps with nulls", map( "nulls", null ),
      "maps with strings", map( "strings", "a string" ),
      "maps with numbers", map( "numbers", 42 ),
      "maps with booleans", map( "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) map.get( "maps with nulls" )).get( "nulls" ), is( nullValue() ) );
  assertThat( ((Map) map.get( "maps with strings" )).get( "strings" ), is( "a string" ) );
  assertThat( ((Map) map.get( "maps with numbers" )).get( "numbers" ), is( 42 ) );
  assertThat( ((Map) map.get( "maps with booleans" )).get( "booleans" ), is( true ) );
}
origin: SonarSource/sonarqube

 @Test
 public void nullNewValue() {
  GlobalPropertyChangeHandler.PropertyChange change = GlobalPropertyChangeHandler.PropertyChange.create("favourite.java.version", null);
  assertThat(change.getNewValue(), nullValue());
  assertThat(change.toString(), is("[key=favourite.java.version, newValue=null]"));
 }
}
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: NemProject/nem.core

@Test
public void identityWithPublicKeyCanBeRoundTripped() {
  // Arrange:
  final PublicKey publicKey = Utils.generateRandomPublicKey();
  // Act:
  final NodeIdentity identity = createRoundTrippedIdentity(new NodeIdentity(new KeyPair(publicKey), "alice"));
  // Assert:
  Assert.assertThat(identity.getAddress().getPublicKey(), IsEqual.equalTo(publicKey));
  Assert.assertThat(identity.getKeyPair().getPrivateKey(), IsNull.nullValue());
  Assert.assertThat(identity.isOwned(), IsEqual.equalTo(false));
  Assert.assertThat(identity.getName(), IsEqual.equalTo("alice"));
}
origin: NemProject/nem.core

@Test
public void canCreateFacadeAroundNoCertificates() throws Exception {
  // Act:
  final URL url = new URL("http://nem.com/foo/n.jar");
  final CodeSourceFacade facade = new CodeSourceFacade(new CodeSource(url, new Certificate[] {}));
  // Assert:
  Assert.assertThat(facade.getLocation(), IsEqual.equalTo(url));
  Assert.assertThat(facade.getFirstCertificate(), IsNull.nullValue());
}
origin: mulesoft/mule

@Test
public void schemaFactoryProperties() throws Exception {
 SetPropertyAnswer setPropertyAnswer = new SetPropertyAnswer(schemaFactory);
 doAnswer(setPropertyAnswer).when(schemaFactoryWrapper).setProperty(anyString(), anyObject());
 defaultXMLSecureFactories.configureSchemaFactory(schemaFactoryWrapper);
 assertThat(setPropertyAnswer.exception, is(nullValue()));
 for (String property : SCHEMA_FACTORY_PROPERTIES) {
  verify(schemaFactoryWrapper).setProperty(property, "");
 }
}
origin: mulesoft/mule

@Test
public void validatorProperties() throws Exception {
 SetPropertyAnswer setPropertyAnswer = new SetPropertyAnswer(schemaFactory.newSchema().newValidator());
 doAnswer(setPropertyAnswer).when(validatorWrapper).setProperty(anyString(), anyObject());
 defaultXMLSecureFactories.configureValidator(validatorWrapper);
 assertThat(setPropertyAnswer.exception, is(nullValue()));
 for (String property : VALIDATOR_PROPERTIES) {
  verify(validatorWrapper).setProperty(property, "");
 }
}
origin: ModeShape/modeshape

protected void addContentToCustomer( Session session,
                   String pathToCustomer,
                   String childName ) throws Exception {
  // Add a child under the node ...
  session.refresh(false);
  Node customer = session.getNode(pathToCustomer);
  Node deck = customer.addNode(childName, "acme:DeckClassType");
  assertThat(deck, is(notNullValue()));
}
origin: ModeShape/modeshape

@Test
public void shouldHaveSystemBranch() throws Exception {
  session = createSession();
  javax.jcr.Node root = session.getRootNode();
  AbstractJcrNode system = (AbstractJcrNode)root.getNode("jcr:system");
  assertThat(system, is(notNullValue()));
}
origin: NemProject/nem.core

@Test
public void canParseVersionStringWithoutTag() {
  // Act:
  final NodeVersion version = NodeVersion.parse("22.1.123");
  // Assert:
  Assert.assertThat(version.getMajorVersion(), IsEqual.equalTo(22));
  Assert.assertThat(version.getMinorVersion(), IsEqual.equalTo(1));
  Assert.assertThat(version.getBuildVersion(), IsEqual.equalTo(123));
  Assert.assertThat(version.getTag(), IsNull.nullValue());
}
origin: ModeShape/modeshape

protected void startEngineAndDeployRepositoryAndLogIn() throws Exception {
  print("starting engine");
  engine.start();
  assertThat(engine.getState(), is(State.RUNNING));
  print("deploying repository");
  repository = engine.deploy(config);
  session = repository.login();
  assertThat(session.getRootNode(), is(notNullValue()));
}
origin: ModeShape/modeshape

private void registerNodeTypes( Session session,
                String resourcePathToCnd ) throws Exception {
  NodeTypeManager nodeTypes = (NodeTypeManager)session.getWorkspace().getNodeTypeManager();
  URL url = getClass().getClassLoader().getResource(resourcePathToCnd);
  assertThat(url, is(notNullValue()));
  nodeTypes.registerNodeTypes(url, true);
}
origin: mulesoft/mule

@Test
public void testSuspendResumeTransaction() throws Exception {
 assertThat(tc.getTransaction(), nullValue());
 Transaction tx = mock(Transaction.class);
 tc.bindTransaction(tx);
 tc.suspendCurrentTransaction();
 assertNull(tc.getTransaction());
 tc.resumeSuspendedTransaction();
 verify(tx, times(1)).suspend();
 verify(tx, times(1)).resume();
 assertThat(tc.getTransaction(), is(tx));
}
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: mulesoft/mule

@Test
public void emptyBuilder() throws Exception {
 MuleContext muleContext =
   newBuilder(new TestServicesConfigurationBuilder()).setExecutionClassloader(currentThread().getContextClassLoader())
     .setClassLoaderRepository(mock(ClassLoaderRepository.class)).build().getMuleContext();
 assertThat(muleContext, notNullValue());
 assertThat(muleContext.isInitialised(), is(true));
 muleContext.start();
 assertThat(muleContext.isStarted(), is(true));
}
origin: ModeShape/modeshape

@Test
public void shouldProvideIdentifierEvenIfNoMixinTypes() throws Exception {
  initializeData();
  // The b node was not set up to be referenceable in this test, but does have a mixin type
  Node node = session.getRootNode().getNode("a").getNode("b").getNode("c");
  assertThat(node.getIdentifier(), is(notNullValue()));
}
origin: NemProject/nem.core

private static void canDeserializeVerifiableBlock(final Block originalBlock, final int expectedType) {
  // Arrange:
  final Deserializer deserializer = Utils.roundtripVerifiableEntity(originalBlock, new MockAccountLookup());
  // Act:
  final Block block = BlockFactory.VERIFIABLE.deserialize(deserializer);
  // Assert:
  Assert.assertThat(block, IsInstanceOf.instanceOf(Block.class));
  Assert.assertThat(block.getType(), IsEqual.equalTo(expectedType));
  Assert.assertThat(block.getSignature(), IsNull.notNullValue());
}
origin: gchq/Gaffer

@Test
public void shouldSetOptionToValue() {
  // When
  final GetAllElements op = new GetAllElements.Builder()
      .option("key", "value")
      .build();
  // Then
  assertThat(op.getOptions(), is(notNullValue()));
  assertThat(op.getOptions().get("key"), is("value"));
}
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 classes and methods

  • runOnUiThread (Activity)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • requestLocationUpdates (LocationManager)
  • Menu (java.awt)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Collections (java.util)
    Collections contains static methods which operate on Collection classes.
  • Iterator (java.util)
    An iterator over a collection. Iterator takes the place of Enumeration in the Java Collections Frame
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor

For IntelliJ IDEA,
Android Studio or Eclipse

  • Codota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutContact Us
  • Terms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)