From 757aea73c705824acb7dea0e12fa72809098efd7 Mon Sep 17 00:00:00 2001
From: Camil Staps
Date: Wed, 10 Jun 2015 18:15:24 +0200
Subject: Cleanup; license

---
 .../test/java/org/rssin/http/SimpleFetcher.java    |  43 --------
 .../org/rssin/listener/SimpleFallibleListener.java |  17 ----
 .../rssin/serialization/JsonSerializationTest.java | 110 ---------------------
 3 files changed, 170 deletions(-)
 delete mode 100644 app/src/test/java/org/rssin/http/SimpleFetcher.java
 delete mode 100644 app/src/test/java/org/rssin/listener/SimpleFallibleListener.java
 delete mode 100644 app/src/test/java/org/rssin/serialization/JsonSerializationTest.java

(limited to 'app/src/test/java/org')

diff --git a/app/src/test/java/org/rssin/http/SimpleFetcher.java b/app/src/test/java/org/rssin/http/SimpleFetcher.java
deleted file mode 100644
index b7e9871..0000000
--- a/app/src/test/java/org/rssin/http/SimpleFetcher.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.rssin.http;
-
-import org.rssin.listener.ErrorListener;
-import org.rssin.listener.Listener;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-/**
- * This Fetcher doesn't work on Android, but can be used for automated tests
- * @author Camil Staps
- */
-public class SimpleFetcher implements Fetcher {
-
-    @Override
-    /**
-     * @todo implement when needed.
-     */
-    public void fetch(Request request) {
-    }
-
-    @Override
-    public void fetch(Request request, Listener listener) {
-        try {
-            BufferedReader in = new BufferedReader(new InputStreamReader(request.getURL().openStream()));
-
-            StringBuilder everything = new StringBuilder();
-            String inputLine;
-            while ((inputLine = in.readLine()) != null)
-                everything.append(inputLine);
-            in.close();
-
-            listener.onReceive(everything.toString());
-        } catch (IOException e) {
-            if (ErrorListener.class.isAssignableFrom(listener.getClass())) {
-                ErrorListener errorListener = (ErrorListener) listener;
-                errorListener.onError(e);
-            }
-        }
-    }
-
-}
diff --git a/app/src/test/java/org/rssin/listener/SimpleFallibleListener.java b/app/src/test/java/org/rssin/listener/SimpleFallibleListener.java
deleted file mode 100644
index 8be95b4..0000000
--- a/app/src/test/java/org/rssin/listener/SimpleFallibleListener.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.rssin.listener;
-
-/**
- * Simple FallibleListener for tests
- * @author Camil Staps
- */
-public class SimpleFallibleListener implements FallibleListener<Object, Object> {
-    @Override
-    public void onError(Object error) {
-        System.err.println(error.toString());
-    }
-
-    @Override
-    public void onReceive(Object data) {
-        System.out.println(data.toString());
-    }
-}
diff --git a/app/src/test/java/org/rssin/serialization/JsonSerializationTest.java b/app/src/test/java/org/rssin/serialization/JsonSerializationTest.java
deleted file mode 100644
index c8cda01..0000000
--- a/app/src/test/java/org/rssin/serialization/JsonSerializationTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.rssin.serialization;
-
-import junit.framework.TestCase;
-
-import org.json.JSONArray;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-import java.util.UUID;
-
-/**
- * Automated tests for the JsonSerializer
- * @author Camil Staps
- */
-public class JsonSerializationTest extends TestCase {
-
-    Random r;
-
-    public JsonSerializationTest() {
-        r = new Random(System.currentTimeMillis());
-    }
-
-    /**
-     * Test that the readObject and writeObject of the inner class SimpleJsonableExample are setup
-     * correctly; otherwise the tests fail because of that.
-     */
-    public void testSimpleJsonableExample() {
-        for (int i = 0; i < 10; i++) {
-            SimpleJsonableExample ex = randomSimpleJsonableExample();
-            SimpleJsonableExample test = new SimpleJsonableExample();
-            try {
-                test.fromJson(ex.toJson());
-            } catch (JSONException e) {
-                fail("JSONException: " + e.getMessage());
-            }
-            assertEquals(ex, test);
-        }
-    }
-
-    /**
-     * Test {@link JsonSerializer#listToJson(List)} and {@link JsonSerializer#listFromJson(JSONArray, List)}
-     * @throws JSONException
-     */
-    public void testLists() throws JSONException {
-        List<SimpleJsonableExample> list = new ArrayList<>();
-        List<SimpleJsonableExample> second_list = new ArrayList<>();
-        for (int i = 0; i < 10; i++) {
-            list.add(randomSimpleJsonableExample());
-            second_list.add(new SimpleJsonableExample());
-        }
-        JsonSerializer.listFromJson(JsonSerializer.listToJson(list), second_list);
-        for (int i = 0; i < 10; i++) {
-            assertEquals(list.get(i), second_list.get(i));
-        }
-    }
-
-    /**
-     * Get a random SimpleJsonableExample
-     * @return
-     */
-    private SimpleJsonableExample randomSimpleJsonableExample() {
-        return new SimpleJsonableExample(UUID.randomUUID().toString(), r.nextInt());
-    }
-
-    /**
-     * A simple Jsonable object with a String and an int.
-     */
-    private static class SimpleJsonableExample implements Jsonable {
-
-        private String myString;
-        private int myInt;
-
-        public SimpleJsonableExample() {
-        }
-
-        public SimpleJsonableExample(String s, int i) {
-            myString = s;
-            myInt = i;
-        }
-
-        @Override
-        public JSONObject toJson() throws JSONException {
-            JSONObject json = new JSONObject();
-            json.put("myString", myString);
-            json.put("myInt", myInt);
-            return json;
-        }
-
-        @Override
-        public void fromJson(JSONObject json) throws JSONException {
-            myString = json.getString("myString");
-            myInt = json.getInt("myInt");
-        }
-
-        @Override
-        public boolean equals(Object o) {
-            if (o == null || o.getClass() != SimpleJsonableExample.class)
-                return false;
-
-            SimpleJsonableExample another = (SimpleJsonableExample) o;
-
-            return another.myString == myString &&
-                    another.myInt == myInt;
-        }
-    }
-
-}
-- 
cgit v1.2.3