diff options
author | Jon Bratseth <bratseth@oath.com> | 2018-03-02 15:34:39 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@oath.com> | 2018-03-02 15:34:39 +0100 |
commit | 3844b4dbcc5e03489e82924ac2e1707897f9e43e (patch) | |
tree | fa450261161697fc44cd89b68ef97ed1afa5e575 /container-accesslogging | |
parent | 8ec5743e254b039fe860339fdc4b5ab4aa1f0364 (diff) |
Remove junit.fdramework usage
Diffstat (limited to 'container-accesslogging')
3 files changed, 29 insertions, 11 deletions
diff --git a/container-accesslogging/src/test/java/com/yahoo/container/logging/JSONLogTestCase.java b/container-accesslogging/src/test/java/com/yahoo/container/logging/JSONLogTestCase.java index 747cb2f83cb..ceafbc18272 100644 --- a/container-accesslogging/src/test/java/com/yahoo/container/logging/JSONLogTestCase.java +++ b/container-accesslogging/src/test/java/com/yahoo/container/logging/JSONLogTestCase.java @@ -1,13 +1,17 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.container.logging; +import org.junit.Test; + import java.net.URI; +import static org.junit.Assert.assertEquals; + /** * @author frodelu */ -public class JSONLogTestCase extends junit.framework.TestCase { +public class JSONLogTestCase { private static String ipAddress = "152.200.54.243"; private static final String EMPTY_REFERRER = ""; @@ -35,6 +39,7 @@ public class JSONLogTestCase extends junit.framework.TestCase { return URI.create("http://localhost?query=" + query); } + @Test public void test_json_log_entry() throws Exception { AccessLogEntry entry = newAccessLogEntry("test"); @@ -60,7 +65,8 @@ public class JSONLogTestCase extends junit.framework.TestCase { assertEquals(expectedOutput, new JSONFormatter(entry).format()); } - public void test_with_keyvalues() throws Exception { + @Test + public void test_with_keyvalues() { AccessLogEntry entry = newAccessLogEntry("test"); entry.addKeyValue("singlevalue", "value1"); entry.addKeyValue("multivalue", "value2"); @@ -92,6 +98,7 @@ public class JSONLogTestCase extends junit.framework.TestCase { } + @Test public void test_with_remoteaddrport() throws Exception { AccessLogEntry entry = newAccessLogEntry("test"); @@ -147,6 +154,7 @@ public class JSONLogTestCase extends junit.framework.TestCase { assertEquals(expectedOutput, new JSONFormatter(entry).format()); } + @Test public void test_remote_address_same_as_ip_address() throws Exception { AccessLogEntry entry = newAccessLogEntry("test"); AccessLogEntry entrywithremote = newAccessLogEntry("test"); @@ -155,7 +163,8 @@ public class JSONLogTestCase extends junit.framework.TestCase { assertEquals(new JSONFormatter(entry).format(), new JSONFormatter(entrywithremote).format()); } - public void test_useragent_with_quotes() throws Exception { + @Test + public void test_useragent_with_quotes() { final AccessLogEntry entry = new AccessLogEntry(); entry.setRawQuery("query=test"); entry.setRawPath(""); diff --git a/container-accesslogging/src/test/java/com/yahoo/container/logging/YApacheLogTestCase.java b/container-accesslogging/src/test/java/com/yahoo/container/logging/YApacheLogTestCase.java index 10ab0d9c6d1..9f02e657952 100644 --- a/container-accesslogging/src/test/java/com/yahoo/container/logging/YApacheLogTestCase.java +++ b/container-accesslogging/src/test/java/com/yahoo/container/logging/YApacheLogTestCase.java @@ -3,6 +3,7 @@ package com.yahoo.container.logging; import com.yahoo.container.core.AccessLogConfig; import org.hamcrest.MatcherAssert; +import org.junit.Test; import java.io.*; import java.net.InetSocketAddress; @@ -17,18 +18,20 @@ import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.core.IsNot.not; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; - +import static org.junit.Assert.assertTrue; /** * @author tonytv */ -public class YApacheLogTestCase extends junit.framework.TestCase { +public class YApacheLogTestCase { private static String ipAddress = "152.200.54.243"; private static final String EMPTY_REFERRER = ""; private static final String EMPTY_USERAGENT = ""; + @Test public void testIt() throws Exception { AccessLogEntry entry = new AccessLogEntry(); addCommonEntries(entry); @@ -83,6 +86,7 @@ public class YApacheLogTestCase extends junit.framework.TestCase { entry.setRemotePort(12345); } + @Test public void test_remote_address_different_from_ip_address() throws Exception { AccessLogEntry entry = new AccessLogEntry(); addCommonEntries(entry); @@ -93,6 +97,7 @@ public class YApacheLogTestCase extends junit.framework.TestCase { new YApacheFormatter(entry).format()); } + @Test public void test_remote_address_same_as_ip_address_does_not_cause_double_adding() throws Exception { AccessLogEntry entry = new AccessLogEntry(); addCommonEntries(entry); @@ -101,6 +106,7 @@ public class YApacheLogTestCase extends junit.framework.TestCase { assertThat(new YApacheFormatter(entry).format(), not(containsString(ipAddress))); } + @Test public void test_status_code_stored_as_decimal() throws Exception { AccessLogEntry entry = new AccessLogEntry(); addCommonEntries(entry); @@ -112,6 +118,7 @@ public class YApacheLogTestCase extends junit.framework.TestCase { /** * author someone-else. Please rewrite this. */ + @Test public void testYApacheAccessLogWithDateNamingScheme() { AccessLogConfig.Builder builder = new AccessLogConfig.Builder(). fileHandler(new AccessLogConfig.FileHandler.Builder(). @@ -154,6 +161,7 @@ public class YApacheLogTestCase extends junit.framework.TestCase { } } + @Test public void testThatQueryWithEncodedCharactersIsLoggedInEncodedForm() { final String query = "%5E%3B%22"; final AccessLogEntry entry = new AccessLogEntry(); @@ -182,6 +190,7 @@ public class YApacheLogTestCase extends junit.framework.TestCase { /** * author someone-else. Please rewrite this. */ + @Test public void testYApacheAccessLogWithSequenceNamingScheme() throws IOException, InterruptedException { // try without existing files assertCorrectSequenceBehavior(1); diff --git a/container-accesslogging/src/test/java/com/yahoo/container/logging/test/LogFormatterTestCase.java b/container-accesslogging/src/test/java/com/yahoo/container/logging/test/LogFormatterTestCase.java index 2e07f9922ef..cb34818c35c 100644 --- a/container-accesslogging/src/test/java/com/yahoo/container/logging/test/LogFormatterTestCase.java +++ b/container-accesslogging/src/test/java/com/yahoo/container/logging/test/LogFormatterTestCase.java @@ -4,16 +4,16 @@ package com.yahoo.container.logging.test; import java.util.Date; import com.yahoo.container.logging.LogFormatter; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; /** - * @author <a href="mailto:travisb@yahoo-inc.com">Bob Travis</a> + * @author Bob Travis */ -public class LogFormatterTestCase extends junit.framework.TestCase { - - public LogFormatterTestCase(String name) { - super(name); - } +public class LogFormatterTestCase { + @Test public void testIt() { java.util.TimeZone.setDefault(java.util.TimeZone.getTimeZone("UTC")); @SuppressWarnings("deprecation") |