| Revision | 255 (tree) |
|---|---|
| Time | 2016-05-03 14:28:54 |
| Author | t_nakayama1971 |
(empty log message)
| @@ -17,11 +17,6 @@ | ||
| 17 | 17 | |
| 18 | 18 | package org.apache.commons.chain2.base; |
| 19 | 19 | |
| 20 | -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; | |
| 21 | -import static org.hamcrest.collection.IsMapContaining.hasEntry; | |
| 22 | -import static org.junit.Assert.assertEquals; | |
| 23 | -import static org.junit.Assert.assertThat; | |
| 24 | - | |
| 25 | 20 | import java.util.Collections; |
| 26 | 21 | import java.util.HashMap; |
| 27 | 22 | import java.util.Map; |
| @@ -28,6 +23,7 @@ | ||
| 28 | 23 | |
| 29 | 24 | import org.apache.commons.chain2.Processing; |
| 30 | 25 | import org.junit.After; |
| 26 | +import org.junit.Assert; | |
| 31 | 27 | import org.junit.Before; |
| 32 | 28 | import org.junit.Test; |
| 33 | 29 |
| @@ -81,7 +77,7 @@ | ||
| 81 | 77 | command.setFromKey("one"); |
| 82 | 78 | execute(); |
| 83 | 79 | |
| 84 | - assertEquals(originalContext, context); | |
| 80 | + Assert.assertEquals(originalContext, context); | |
| 85 | 81 | } |
| 86 | 82 | |
| 87 | 83 | /** |
| @@ -92,7 +88,7 @@ | ||
| 92 | 88 | command.setToKey("one"); |
| 93 | 89 | execute(); |
| 94 | 90 | |
| 95 | - assertEquals(originalContext, context); | |
| 91 | + Assert.assertEquals(originalContext, context); | |
| 96 | 92 | } |
| 97 | 93 | |
| 98 | 94 | /** |
| @@ -105,15 +101,15 @@ | ||
| 105 | 101 | |
| 106 | 102 | execute(); |
| 107 | 103 | |
| 108 | - assertThat(context, hasEntry("one", (Object) "one")); | |
| 109 | - assertThat(context, hasEntry("two", (Object) "one")); | |
| 110 | - assertThat(context, hasEntry("three", (Object) "three")); | |
| 111 | - assertThat(context.keySet(), hasSize(3)); | |
| 104 | + Assert.assertEquals("one", context.get("one")); | |
| 105 | + Assert.assertEquals("two", context.get("two")); | |
| 106 | + Assert.assertEquals("three", context.get("three")); | |
| 107 | + Assert.assertEquals(3, context.size()); | |
| 112 | 108 | } |
| 113 | 109 | |
| 114 | 110 | private void execute() { |
| 115 | 111 | // make sure execute always returns continue |
| 116 | - assertEquals(Processing.CONTINUE, command.execute(context)); | |
| 112 | + Assert.assertEquals(Processing.CONTINUE, command.execute(context)); | |
| 117 | 113 | } |
| 118 | 114 | |
| 119 | 115 | } |
| @@ -17,17 +17,14 @@ | ||
| 17 | 17 | |
| 18 | 18 | package org.apache.commons.chain2.base; |
| 19 | 19 | |
| 20 | -import static org.hamcrest.collection.IsMapContaining.hasKey; | |
| 21 | -import static org.hamcrest.core.IsNot.not; | |
| 22 | -import static org.junit.Assert.assertThat; | |
| 23 | - | |
| 24 | 20 | import org.apache.commons.chain2.Context; |
| 25 | 21 | import org.apache.commons.chain2.impl.TestContext; |
| 22 | +import org.junit.Assert; | |
| 26 | 23 | import org.junit.Before; |
| 27 | 24 | import org.junit.Test; |
| 28 | 25 | |
| 29 | 26 | /** |
| 30 | - * @version $Id� | |
| 27 | + * @version $Id$ | |
| 31 | 28 | */ |
| 32 | 29 | public class RemoveCommandTestCase { |
| 33 | 30 |
| @@ -55,8 +52,8 @@ | ||
| 55 | 52 | command.setFromKey("yet another Key"); |
| 56 | 53 | command.execute(context); |
| 57 | 54 | |
| 58 | - assertThat(context, hasKey("Key")); | |
| 59 | - assertThat(context, hasKey("another Key")); | |
| 55 | + Assert.assertTrue(context.containsKey("Key")); | |
| 56 | + Assert.assertTrue(context.containsKey("another Key")); | |
| 60 | 57 | } |
| 61 | 58 | |
| 62 | 59 | /** |
| @@ -67,8 +64,8 @@ | ||
| 67 | 64 | command.setFromKey("Key"); |
| 68 | 65 | command.execute(context); |
| 69 | 66 | |
| 70 | - assertThat(context, not(hasKey("Key"))); | |
| 71 | - assertThat(context, hasKey("another Key")); | |
| 67 | + Assert.assertFalse(context.containsKey("Key")); | |
| 68 | + Assert.assertTrue(context.containsKey("another Key")); | |
| 72 | 69 | } |
| 73 | 70 | |
| 74 | 71 | } |
| @@ -17,13 +17,10 @@ | ||
| 17 | 17 | |
| 18 | 18 | package org.apache.commons.chain2.base; |
| 19 | 19 | |
| 20 | -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; | |
| 21 | -import static org.hamcrest.collection.IsMapContaining.hasEntry; | |
| 22 | -import static org.junit.Assert.assertThat; | |
| 23 | - | |
| 24 | 20 | import java.util.HashMap; |
| 25 | 21 | import java.util.Map; |
| 26 | 22 | |
| 23 | +import org.junit.Assert; | |
| 27 | 24 | import org.junit.Before; |
| 28 | 25 | import org.junit.Test; |
| 29 | 26 |
| @@ -57,8 +54,8 @@ | ||
| 57 | 54 | |
| 58 | 55 | command.execute(context); |
| 59 | 56 | |
| 60 | - assertThat(context, hasEntry("Key", (Object) "Value")); | |
| 61 | - assertThat(context.keySet(), hasSize(1)); | |
| 57 | + Assert.assertEquals("Value", context.get("Key")); | |
| 58 | + Assert.assertEquals(1, context.size()); | |
| 62 | 59 | } |
| 63 | 60 | |
| 64 | 61 | /** |
| @@ -71,7 +68,7 @@ | ||
| 71 | 68 | |
| 72 | 69 | command.execute(context); |
| 73 | 70 | |
| 74 | - assertThat(context, hasEntry("Key", (Object) "new Value")); | |
| 75 | - assertThat(context.keySet(), hasSize(1)); | |
| 71 | + Assert.assertEquals("new Value", context.get("Key")); | |
| 72 | + Assert.assertEquals(1, context.size()); | |
| 76 | 73 | } |
| 77 | 74 | } |
| @@ -29,7 +29,7 @@ | ||
| 29 | 29 | |
| 30 | 30 | |
| 31 | 31 | /** |
| 32 | - * Mock Object for HttpServletResponse (Version 2.3) | |
| 32 | + * Mock Object for HttpServletResponse | |
| 33 | 33 | */ |
| 34 | 34 | public class MockHttpServletResponse implements HttpServletResponse { |
| 35 | 35 |
| @@ -308,4 +308,12 @@ | ||
| 308 | 308 | return 0; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | + /** | |
| 312 | + * @see javax.servlet.ServletResponse#setContentLengthLong(long) | |
| 313 | + */ | |
| 314 | + @Override | |
| 315 | + public void setContentLengthLong(long arg0) { | |
| 316 | + return; | |
| 317 | + } | |
| 318 | + | |
| 311 | 319 | } |
| @@ -470,4 +470,12 @@ | ||
| 470 | 470 | return; |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | + /** | |
| 474 | + * @see javax.servlet.ServletContext#getVirtualServerName() | |
| 475 | + */ | |
| 476 | + @Override | |
| 477 | + public String getVirtualServerName() { | |
| 478 | + return null; | |
| 479 | + } | |
| 480 | + | |
| 473 | 481 | } |
| @@ -39,6 +39,7 @@ | ||
| 39 | 39 | import javax.servlet.http.HttpServletRequest; |
| 40 | 40 | import javax.servlet.http.HttpServletResponse; |
| 41 | 41 | import javax.servlet.http.HttpSession; |
| 42 | +import javax.servlet.http.HttpUpgradeHandler; | |
| 42 | 43 | import javax.servlet.http.Part; |
| 43 | 44 | |
| 44 | 45 | import org.apache.commons.chain2.web.MockEnumeration; |
| @@ -46,7 +47,7 @@ | ||
| 46 | 47 | |
| 47 | 48 | |
| 48 | 49 | /** |
| 49 | - * Mock Object for HttpServletRequest (Version 2.3) | |
| 50 | + * Mock Object for HttpServletRequest | |
| 50 | 51 | */ |
| 51 | 52 | public class MockHttpServletRequest implements HttpServletRequest { |
| 52 | 53 |
| @@ -724,4 +725,28 @@ | ||
| 724 | 725 | return; |
| 725 | 726 | } |
| 726 | 727 | |
| 728 | + /** | |
| 729 | + * @see javax.servlet.ServletRequest#getContentLengthLong() | |
| 730 | + */ | |
| 731 | + @Override | |
| 732 | + public long getContentLengthLong() { | |
| 733 | + return 0; | |
| 734 | + } | |
| 735 | + | |
| 736 | + /** | |
| 737 | + * @see javax.servlet.http.HttpServletRequest#changeSessionId() | |
| 738 | + */ | |
| 739 | + @Override | |
| 740 | + public String changeSessionId() { | |
| 741 | + return null; | |
| 742 | + } | |
| 743 | + | |
| 744 | + /** | |
| 745 | + * @see javax.servlet.http.HttpServletRequest#upgrade(java.lang.Class) | |
| 746 | + */ | |
| 747 | + @Override | |
| 748 | + public <T extends HttpUpgradeHandler> T upgrade(Class<T> arg0) throws IOException, ServletException { | |
| 749 | + return null; | |
| 750 | + } | |
| 751 | + | |
| 727 | 752 | } |
| @@ -18,15 +18,12 @@ | ||
| 18 | 18 | package org.apache.commons.chain2.testutils; |
| 19 | 19 | |
| 20 | 20 | import static org.apache.commons.chain2.testutils.HasLog.hasLog; |
| 21 | -import static org.hamcrest.collection.IsCollectionWithSize.hasSize; | |
| 22 | -import static org.hamcrest.collection.IsMapContaining.hasKey; | |
| 23 | -import static org.junit.Assert.assertThat; | |
| 24 | -import static org.junit.Assert.assertEquals; | |
| 25 | 21 | |
| 26 | 22 | import java.util.UUID; |
| 27 | 23 | |
| 28 | 24 | import org.apache.commons.chain2.Context; |
| 29 | 25 | import org.apache.commons.chain2.Processing; |
| 26 | +import org.junit.Assert; | |
| 30 | 27 | import org.junit.Before; |
| 31 | 28 | import org.junit.Test; |
| 32 | 29 |
| @@ -64,9 +61,9 @@ | ||
| 64 | 61 | public void createsLogInEmptyContext() { |
| 65 | 62 | execute(); |
| 66 | 63 | |
| 67 | - assertThat(context.keySet(), hasSize(1)); | |
| 68 | - assertThat(context, hasKey("log")); | |
| 69 | - assertThat(context, hasLog(ID)); | |
| 64 | + Assert.assertEquals(1, context.size()); | |
| 65 | + Assert.assertTrue(context.containsKey("log")); | |
| 66 | + Assert.assertThat(context, hasLog(ID)); | |
| 70 | 67 | } |
| 71 | 68 | |
| 72 | 69 | /** |
| @@ -77,10 +74,10 @@ | ||
| 77 | 74 | context.put("log", new StringBuilder("some content")); |
| 78 | 75 | execute(); |
| 79 | 76 | |
| 80 | - assertThat(context, hasLog("some content/" + ID)); | |
| 77 | + Assert.assertThat(context, hasLog("some content/" + ID)); | |
| 81 | 78 | } |
| 82 | 79 | |
| 83 | 80 | private void execute() { |
| 84 | - assertEquals(Processing.FINISHED, command.execute(context)); | |
| 81 | + Assert.assertEquals(Processing.FINISHED, command.execute(context)); | |
| 85 | 82 | } |
| 86 | 83 | } |