From 30bf0d7bc5b29fd387eb9e475a8e5cfb6dac2a39 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 26 Aug 2014 02:17:12 +0200 Subject: [PATCH] Made MockSyncthingService a complete stub of SyncthingService. Now all methods are overriden, and throw UnsupportedOperationException unless used by a test. --- .../test/MockSyncthingService.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/src/androidTest/java/com/nutomic/syncthingandroid/test/MockSyncthingService.java b/src/androidTest/java/com/nutomic/syncthingandroid/test/MockSyncthingService.java index 9548a9af..43fb322b 100644 --- a/src/androidTest/java/com/nutomic/syncthingandroid/test/MockSyncthingService.java +++ b/src/androidTest/java/com/nutomic/syncthingandroid/test/MockSyncthingService.java @@ -1,5 +1,10 @@ package com.nutomic.syncthingandroid.test; +import android.app.Activity; +import android.content.Intent; +import android.os.IBinder; + +import com.nutomic.syncthingandroid.syncthing.RestApi; import com.nutomic.syncthingandroid.syncthing.SyncthingService; import java.util.LinkedList; @@ -9,6 +14,46 @@ public class MockSyncthingService extends SyncthingService { private LinkedList mOnApiChangedListeners = new LinkedList<>(); + @Override + public int onStartCommand(Intent intent, int flags, int startId) { + throw new UnsupportedOperationException(); + } + + @Override + public void updateState() { + throw new UnsupportedOperationException(); + } + + @Override + public void onCreate() { + throw new UnsupportedOperationException(); + } + + @Override + public IBinder onBind(Intent intent) { + throw new UnsupportedOperationException(); + } + + @Override + public void onDestroy() { + throw new UnsupportedOperationException(); + } + + @Override + public void registerOnWebGuiAvailableListener(OnWebGuiAvailableListener listener) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isFirstStart() { + throw new UnsupportedOperationException(); + } + + @Override + public RestApi getApi() { + throw new UnsupportedOperationException(); + } + @Override public void registerOnApiChangeListener(OnApiChangeListener listener) { mOnApiChangedListeners.add(listener); @@ -23,4 +68,9 @@ public class MockSyncthingService extends SyncthingService { return false; } + @Override + public String getWebGuiUrl() { + throw new UnsupportedOperationException(); + } + }