Merge branch 'add-Tests' of https://github.com/TheRealHaui/jetty.project into jetty-9.4.x
This commit is contained in:
commit
797b6af1fb
|
@ -0,0 +1,45 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2019 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// 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
|
||||
//
|
||||
// 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.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.plus.jndi;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
/**
|
||||
* Unit tests for class {@link NamingEntryUtil}.
|
||||
*
|
||||
* @see NamingEntryUtil
|
||||
*
|
||||
*/
|
||||
public class NamingEntryUtilTest{
|
||||
|
||||
@Test
|
||||
public void testBindToENCWithEmptyStringAndBindToENCThrowsNamingException() {
|
||||
assertThrows(NamingException.class, () -> NamingEntryUtil.bindToENC(new Object(), "", ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBindToENCWithNullAndNullThrowsNamingException() {
|
||||
assertThrows( NamingException.class, () -> NamingEntryUtil.bindToENC( null, null, "@=<9"));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,82 @@
|
|||
//
|
||||
// ========================================================================
|
||||
// Copyright (c) 1995-2019 Mort Bay Consulting Pty. Ltd.
|
||||
// ------------------------------------------------------------------------
|
||||
// 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
|
||||
//
|
||||
// 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.
|
||||
// ========================================================================
|
||||
//
|
||||
|
||||
package org.eclipse.jetty.start;
|
||||
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
/**
|
||||
* Unit tests for class {@link Utils}.
|
||||
*
|
||||
* @see Utils
|
||||
*
|
||||
*/
|
||||
public class UtilsTest{
|
||||
|
||||
@Test
|
||||
public void testIsNotBlankReturningTrue() {
|
||||
assertTrue(Utils.isNotBlank(" @t;3/|O)t"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsNotBlankReturningFalse() {
|
||||
assertFalse(Utils.isNotBlank(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsBlank() {
|
||||
assertFalse(Utils.isBlank(" i3o0e!#4u%QW"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsBlankUsingNull() {
|
||||
assertTrue(Utils.isBlank(null));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJoin() {
|
||||
assertEquals("", Utils.join((Collection<?>) null, "V9ewe2K"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJoinTaking4ArgumentsAndReturningEmptyString() {
|
||||
assertEquals("", Utils.join((Object[]) null, (-3563), 1051, ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJoinUsingObjectArrayOne() {
|
||||
assertEquals("", Utils.join((Object[]) null, ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJoinUsingObjectArrayTwo() {
|
||||
Object[] objectArray = new Object[8];
|
||||
String joinedString = Utils.join(objectArray, "%.g[{2G<1");
|
||||
|
||||
assertEquals(8, objectArray.length);
|
||||
assertEquals("null%.g[{2G<1null%.g[{2G<1null%.g[{2G<1null%.g[{2G<1null%.g[{2G<1null%.g[{2G<1null%.g[{2G<1null", joinedString);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue