package com.msc.serverbrowser.util.basic;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

/**
 * @author Marcel
 * @since 21.09.2017
 */
@SuppressWarnings("javadoc")
public class StringUtilityTest {
	@Test
	public void testStringToBoolean() {
		Assertions.assertEquals(true, StringUtility.stringToBoolean("true"));
		Assertions.assertEquals(true, StringUtility.stringToBoolean("1"));
		Assertions.assertEquals(true, StringUtility.stringToBoolean("True"));
		Assertions.assertEquals(true, StringUtility.stringToBoolean("TRUE"));

		Assertions.assertEquals(false, StringUtility.stringToBoolean(null));
		Assertions.assertEquals(false, StringUtility.stringToBoolean("0"));
		Assertions.assertEquals(false, StringUtility.stringToBoolean("1 "));
		Assertions.assertEquals(false, StringUtility.stringToBoolean(" 1"));
		Assertions.assertEquals(false, StringUtility.stringToBoolean("Kauderwelsch"));
		Assertions.assertEquals(false, StringUtility.stringToBoolean(""));
		Assertions.assertEquals(false, StringUtility.stringToBoolean("false"));
	}

	@Test
	public void testFixUrl() {
		assertEquals("https://google.com", StringUtility.fixUrlIfNecessary("https://google.com"));
		assertEquals("http://google.com", StringUtility.fixUrlIfNecessary("http://google.com"));
		assertEquals("http://google.com", StringUtility.fixUrlIfNecessary("google.com"));
		assertEquals("http://", StringUtility.fixUrlIfNecessary(""));
		assertThrows(NullPointerException.class, () -> StringUtility.fixUrlIfNecessary(null));
	}
}

@@ -163,49 +163,8 @@
 s;%0A%0A
-import org.junit.jupiter.api.Assertions;%0A
 impo
@@ -350,27 +350,16 @@
 n() %7B%0A%09%09
-Assertions.
 assertEq
@@ -407,35 +407,24 @@
 %22true%22));%0A%09%09
-Assertions.
 assertEquals
@@ -465,35 +465,24 @@
 an(%221%22));%0A%09%09
-Assertions.
 assertEquals
@@ -526,35 +526,24 @@
 %22True%22));%0A%09%09
-Assertions.
 assertEquals
@@ -592,27 +592,16 @@
 %22));%0A%0A%09%09
-Assertions.
 assertEq
@@ -648,35 +648,24 @@
 n(null));%0A%09%09
-Assertions.
 assertEquals
@@ -707,35 +707,24 @@
 an(%220%22));%0A%09%09
-Assertions.
 assertEquals
@@ -767,35 +767,24 @@
 n(%221 %22));%0A%09%09
-Assertions.
 assertEquals
@@ -827,35 +827,24 @@
 n(%22 1%22));%0A%09%09
-Assertions.
 assertEquals
@@ -897,35 +897,24 @@
 elsch%22));%0A%09%09
-Assertions.
 assertEquals
@@ -959,27 +959,16 @@
 %22%22));%0A%09%09
-Assertions.
 assertEq

Add static import for assertEquals in StringUtilityTest