Merge commit '42b2e5ca519766e37ce6941ba4faecc9691cc403' into upstream
[debian/openrocket] / core / test / net / sf / openrocket / communication / HttpURLConnectionMock.java
index ab5c48ab7becc5d1c9f4b28cbc7b4134fb2f9a00..57f5d5203f444fe365ef6948703221aa6f10ac14 100644 (file)
@@ -14,12 +14,13 @@ import java.net.URL;
 import java.security.Permission;
 import java.util.HashMap;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import net.sf.openrocket.util.BugException;
 
 public class HttpURLConnectionMock extends HttpURLConnection {
-
+       
        private static final URL MOCK_URL;
        static {
                try {
@@ -88,7 +89,7 @@ public class HttpURLConnectionMock extends HttpURLConnection {
        }
        
        
-
+       
        @Override
        public void connect() {
                if (!connected) {
@@ -99,17 +100,17 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        connected = true;
                }
        }
-
+       
        @Override
        public void disconnect() {
                
        }
-
+       
        @Override
        public boolean usingProxy() {
                return false;
        }
-
+       
        
        
        
@@ -117,69 +118,69 @@ public class HttpURLConnectionMock extends HttpURLConnection {
        public boolean getInstanceFollowRedirects() {
                return this.instanceFollowRedirects;
        }
-
+       
        @Override
        public void setInstanceFollowRedirects(boolean followRedirects) {
                assertFalse(connected);
                this.instanceFollowRedirects = followRedirects;
        }
-
+       
        @Override
        public String getRequestMethod() {
-               return this.requestMethod; 
+               return this.requestMethod;
        }
-
+       
        @Override
        public void setRequestMethod(String method) throws ProtocolException {
                assertFalse(connected);
                this.requestMethod = method;
        }
-
+       
        @Override
        public int getResponseCode() throws IOException {
                connect();
                return this.responseCode;
        }
-
+       
        public void setResponseCode(int code) {
                this.responseCode = code;
        }
        
-
+       
        @Override
        public void addRequestProperty(String key, String value) {
                assertFalse(connected);
-               assertFalse(this.requestProperties.containsKey(key.toLowerCase()));
-               this.requestProperties.put(key.toLowerCase(), value);
+               assertFalse(this.requestProperties.containsKey(key.toLowerCase(Locale.ENGLISH)));
+               this.requestProperties.put(key.toLowerCase(Locale.ENGLISH), value);
        }
-
-
+       
+       
        @Override
        public void setRequestProperty(String key, String value) {
                assertFalse(connected);
-               this.requestProperties.put(key.toLowerCase(), value);
+               this.requestProperties.put(key.toLowerCase(Locale.ENGLISH), value);
        }
-
-
+       
+       
        @Override
        public String getRequestProperty(String key) {
-               return this.requestProperties.get(key.toLowerCase());
+               return this.requestProperties.get(key.toLowerCase(Locale.ENGLISH));
        }
-
-
+       
+       
        @Override
        public int getConnectTimeout() {
                return this.connectTimeout;
        }
-
+       
        @Override
        public void setConnectTimeout(int timeout) {
                assertFalse(connected);
                this.connectTimeout = timeout;
        }
-
-
-
+       
+       
+       
        @Override
        public String getContentEncoding() {
                connect();
@@ -189,9 +190,9 @@ public class HttpURLConnectionMock extends HttpURLConnection {
        public void setContentEncoding(String encoding) {
                this.contentEncoding = encoding;
        }
-
-
-
+       
+       
+       
        @Override
        public int getContentLength() {
                connect();
@@ -199,7 +200,7 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        return 0;
                return content.length;
        }
-
+       
        public void setContent(byte[] content) {
                this.content = content;
        }
@@ -211,8 +212,8 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        fail("UTF-8");
                }
        }
-
-
+       
+       
        @Override
        public String getContentType() {
                connect();
@@ -222,35 +223,35 @@ public class HttpURLConnectionMock extends HttpURLConnection {
        public void setContentType(String type) {
                this.contentType = type;
        }
-
-
-
+       
+       
+       
        @Override
        public boolean getDoInput() {
                return this.doInput;
        }
-
-
+       
+       
        @Override
        public void setDoInput(boolean doinput) {
                assertFalse(connected);
                this.doInput = doinput;
        }
-
-
+       
+       
        @Override
        public boolean getDoOutput() {
                return this.doOutput;
        }
-
-
+       
+       
        @Override
        public void setDoOutput(boolean dooutput) {
                assertFalse(connected);
                this.doOutput = dooutput;
        }
-
-
+       
+       
        @Override
        public InputStream getInputStream() throws IOException {
                assertTrue(doInput);
@@ -261,8 +262,8 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                inputStream = new ByteArrayInputStream(content);
                return inputStream;
        }
-
-
+       
+       
        @Override
        public OutputStream getOutputStream() throws IOException {
                assertTrue(doOutput);
@@ -283,29 +284,26 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        return null;
                }
        }
-
-
-
+       
+       
+       
        @Override
        public void setUseCaches(boolean usecaches) {
                assertFalse(connected);
                this.useCaches = usecaches;
        }
-
-
-
+       
+       
+       
        @Override
        public boolean getUseCaches() {
                return this.useCaches;
        }
-
-
-
-
-
-
-
-
+       
+       
+       
+       
+       
        private void assertNull(Object o) {
                try {
                        org.junit.Assert.assertNull(o);
@@ -314,7 +312,7 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        throw e;
                }
        }
-
+       
        private void assertNotNull(Object o) {
                try {
                        org.junit.Assert.assertNotNull(o);
@@ -323,7 +321,7 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        throw e;
                }
        }
-
+       
        private void assertTrue(boolean o) {
                try {
                        org.junit.Assert.assertTrue(o);
@@ -332,7 +330,7 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        throw e;
                }
        }
-
+       
        private void assertFalse(boolean o) {
                try {
                        org.junit.Assert.assertFalse(o);
@@ -341,209 +339,196 @@ public class HttpURLConnectionMock extends HttpURLConnection {
                        throw e;
                }
        }
-
+       
        private void fail(String msg) {
                failed = true;
                org.junit.Assert.fail(msg);
        }
-
-
-
-       
-
-
-
-
-
        
        
        
        
-
-       
        
-
-
        @Override
        public InputStream getErrorStream() {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public String getHeaderField(int n) {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public long getHeaderFieldDate(String name, long Default) {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public String getHeaderFieldKey(int n) {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public Permission getPermission() throws IOException {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public String getResponseMessage() throws IOException {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public void setChunkedStreamingMode(int chunklen) {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public void setFixedLengthStreamingMode(int contentLength) {
                throw new UnsupportedOperationException();
        }
-
-
-
-
-
+       
+       
+       
+       
+       
        @Override
        public boolean getAllowUserInteraction() {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public Object getContent() throws IOException {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @SuppressWarnings("unchecked")
        @Override
        public Object getContent(Class[] classes) throws IOException {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public long getDate() {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public boolean getDefaultUseCaches() {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public long getExpiration() {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public String getHeaderField(String name) {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public int getHeaderFieldInt(String name, int Default) {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public Map<String, List<String>> getHeaderFields() {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public long getIfModifiedSince() {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public long getLastModified() {
                throw new UnsupportedOperationException();
        }
-
+       
        @Override
        public int getReadTimeout() {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public Map<String, List<String>> getRequestProperties() {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public URL getURL() {
                throw new UnsupportedOperationException();
        }
-
-
-
+       
+       
+       
        @Override
        public void setAllowUserInteraction(boolean allowuserinteraction) {
                throw new UnsupportedOperationException();
        }
-
+       
        @Override
        public void setDefaultUseCaches(boolean defaultusecaches) {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public void setIfModifiedSince(long ifmodifiedsince) {
                throw new UnsupportedOperationException();
        }
-
-
+       
+       
        @Override
        public void setReadTimeout(int timeout) {
                throw new UnsupportedOperationException();
        }
-
-
-
-
-
+       
+       
+       
+       
+       
        @Override
        public String toString() {
                throw new UnsupportedOperationException();
        }
-
+