<commit_before>/*
 *  Copyright (c) 2017 <NAME> and others
 *   All rights reserved. This program and the accompanying materials
 *   are made available under the terms of the Eclipse Public License v1.0
 *   and Apache License v2.0 which accompanies this distribution.
 *   The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 *   and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
 *
 *   You may elect to redistribute this code under either of these licenses.
 *
 *   Contributors:
 *
 *   <NAME>
 */

package org.jnosql.diana.mongodb.document;

import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import java.io.IOException;

import static org.junit.Assert.assertNotNull;


public class MongoDBDocumentCollectionManagerFactoryTest {

    private static MongoDBDocumentConfiguration configuration;

    @BeforeClass
    public static void setUp() throws IOException {
        configuration = new MongoDBDocumentConfiguration();
        MongoDbHelper.startMongoDb();
    }

    @Test
    public void shouldCreateEntityManager() {
        MongoDBDocumentCollectionManagerFactory mongoDBFactory = configuration.get();
        assertNotNull(mongoDBFactory.get("database"));
    }

    @Test
    public void shouldCreateEntityManagerAsync() {
        MongoDBDocumentCollectionManagerAsyncFactory mongoDBFactory = configuration.getAsync();
        assertNotNull(mongoDBFactory.getAsync("database"));
    }

    @AfterClass
    public static void end(){
        MongoDbHelper.stopMongoDb();
    }
}<commit_msg>Adds check NPE tests<commit_after>/*
 *  Copyright (c) 2017 <NAME> and others
 *   All rights reserved. This program and the accompanying materials
 *   are made available under the terms of the Eclipse Public License v1.0
 *   and Apache License v2.0 which accompanies this distribution.
 *   The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 *   and the Apache License v2.0 is available at http://www.opensource.org/licenses/apache2.0.php.
 *
 *   You may elect to redistribute this code under either of these licenses.
 *
 *   Contributors:
 *
 *   <NAME>
 */

package org.jnosql.diana.mongodb.document;

import org.jnosql.diana.api.Settings;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;

import java.io.IOException;
import java.util.Map;

import static org.junit.Assert.assertNotNull;


public class MongoDBDocumentCollectionManagerFactoryTest {

    private static MongoDBDocumentConfiguration configuration;

    @BeforeClass
    public static void setUp() throws IOException {
        configuration = new MongoDBDocumentConfiguration();
        MongoDbHelper.startMongoDb();
    }

    @Test
    public void shouldCreateEntityManager() {
        MongoDBDocumentCollectionManagerFactory mongoDBFactory = configuration.get();
        assertNotNull(mongoDBFactory.get("database"));
    }

    @Test(expected = NullPointerException.class)
    public void shouldReturnNPEWhenSettingsIsNull() {
        configuration.get((Settings) null);
    }

    @Test(expected = NullPointerException.class)
    public void shouldReturnNPEWhenMapSettingsIsNull() {
        configuration.get((Map<String, String>) null);
    }


    @Test
    public void shouldCreateEntityManagerAsync() {
        MongoDBDocumentCollectionManagerAsyncFactory mongoDBFactory = configuration.getAsync();
        assertNotNull(mongoDBFactory.getAsync("database"));
    }

    @Test(expected = NullPointerException.class)
    public void shouldReturnNPEWhenSettingOnAsyncsIsNull() {
        configuration.getAsync((Settings) null);
    }

    @AfterClass
    public static void end() {
        MongoDbHelper.stopMongoDb();
    }
}
{'fraction_non_alphanumeric': 0.08511763150938409, 'fraction_numerical': 0.007401533174729051, 'mean_word_length': 3.765743073047859, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6749625', 'n_tokens_mistral': 1042, 'n_tokens_neox': 1014, 'n_words': 269}