@@ -0,0 +1,3067 @@
+/*%0A * Copyright 2017 Daniel Pedraza-Arcega%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage com.github.danzx.zekke.mongo;%0A%0Aimport static org.assertj.core.api.Assertions.assertThat;%0Aimport static org.assertj.core.api.Assertions.assertThatThrownBy;%0A%0Aimport com.github.danzx.zekke.test.paramprovider.BlankStringProvider;%0Aimport com.mongodb.MongoCredential;%0Aimport com.mongodb.ServerAddress;%0A%0Aimport junitparams.JUnitParamsRunner;%0Aimport junitparams.Parameters;%0A%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0A%0A@RunWith(JUnitParamsRunner.class) %0Apublic class MongoDbSettingsTest %7B%0A%0A    private static final String ANY_STR = %22any%22;%0A    private static final int ANY_INT = 80;%0A    @Test%0A    public void shouldConstructorThrowNullPointExceptionWhenHostIsNull() %7B%0A        assertThatThrownBy(() -%3E new MongoDbSettings(null, ANY_STR, ANY_INT, ANY_STR, ANY_STR)).isInstanceOf(NullPointerException.class);%0A    %7D%0A%0A    @Test%0A    public void shouldConstructorThrowNullPointExceptionWhenDatabaseIsNull() %7B%0A        assertThatThrownBy(() -%3E new MongoDbSettings(ANY_STR, null, ANY_INT, ANY_STR, ANY_STR)).isInstanceOf(NullPointerException.class);%0A    %7D%0A%0A    @Test%0A    @Parameters(source = BlankStringProvider.class) %0A    public void shouldConstructorThrowIllegalArgumentExceptionWhenDatabaseIsBlank(String blank) %7B%0A        assertThatThrownBy(() -%3E new MongoDbSettings(ANY_STR, blank, ANY_INT, ANY_STR, ANY_STR)).isInstanceOf(IllegalArgumentException.class);%0A    %7D%0A%0A    @Test%0A    @Parameters(method = %22usersAndPasswords%22)%0A    public void shouldConstructorObject(String user, String password, boolean isCredentialPresent) %7B%0A        MongoDbSettings settings = new MongoDbSettings(ANY_STR, ANY_STR, ANY_INT, user, password);%0A        assertThat(settings.getDatabase()).isNotNull().isEqualTo(ANY_STR);%0A        assertThat(settings.getAddress()).isNotNull().extracting(ServerAddress::getHost, ServerAddress::getPort).containsExactly(ANY_STR, ANY_INT);%0A        assertThat(settings.getCredential().isPresent()).isEqualTo(isCredentialPresent);%0A        char%5B%5D passwordArray = password == null ? new char%5B0%5D : password.toCharArray();%0A        settings.getCredential().ifPresent(credential -%3E assertThat(credential).extracting(MongoCredential::getUserName, MongoCredential::getPassword).containsExactly(user, passwordArray));%0A    %7D%0A%0A    protected Object%5B%5D usersAndPasswords() %7B%0A        return new Object%5B%5D%5B%5D %7B%0A            %7Bnull, null, false%7D,%0A            %7Bnull, ANY_STR, false%7D,%0A            %7BANY_STR, ANY_STR, true%7D,%0A            %7BANY_STR, null, true%7D,%0A        %7D;%0A    %7D%0A%7D%0A

Add MongoDbSettingsTest