TBR java moments; yet more v23 isolation.

Wrapping more static v23 api behind instance oriented interfaces.

Change-Id: I0abd34ffc7e53e622b25ef6137e7d33ea1b6ea57
diff --git a/projects/moments/app/src/main/java/io/v/moments/model/AdvertiserFactory.java b/projects/moments/app/src/main/java/io/v/moments/model/AdvertiserFactory.java
index dabda5c..2b26e51 100644
--- a/projects/moments/app/src/main/java/io/v/moments/model/AdvertiserFactory.java
+++ b/projects/moments/app/src/main/java/io/v/moments/model/AdvertiserFactory.java
@@ -33,7 +33,7 @@
             return mLocalAds.get(moment.getId());
         }
         Advertiser result = mV23Manager.makeAdvertiser(
-                new MomentAdSupporter(moment),
+                new MomentAdCampaign(moment),
                 Config.Discovery.DURATION,
                 Config.Discovery.NO_PATTERNS);
         mLocalAds.put(moment.getId(), result);
diff --git a/projects/moments/app/src/main/java/io/v/moments/model/MomentAdSupporter.java b/projects/moments/app/src/main/java/io/v/moments/model/MomentAdCampaign.java
similarity index 95%
rename from projects/moments/app/src/main/java/io/v/moments/model/MomentAdSupporter.java
rename to projects/moments/app/src/main/java/io/v/moments/model/MomentAdCampaign.java
index e7bb2ad..5cfd4a3 100644
--- a/projects/moments/app/src/main/java/io/v/moments/model/MomentAdSupporter.java
+++ b/projects/moments/app/src/main/java/io/v/moments/model/MomentAdCampaign.java
@@ -12,7 +12,7 @@
 import java.io.ByteArrayOutputStream;
 import java.util.List;
 
-import io.v.moments.v23.ifc.AdSupporter;
+import io.v.moments.v23.ifc.AdCampaign;
 import io.v.moments.ifc.Moment;
 import io.v.v23.context.VContext;
 import io.v.v23.discovery.Attachments;
@@ -22,12 +22,12 @@
 /**
  * Makes objects that support the advertisement of a Moment.
  */
-class MomentAdSupporter implements AdSupporter {
+class MomentAdCampaign implements AdCampaign {
     private static final String NO_MOUNT_NAME = "";
 
     private final Moment mMoment;
 
-    public MomentAdSupporter(Moment moment) {
+    public MomentAdCampaign(Moment moment) {
         mMoment = moment;
     }
 
diff --git a/projects/moments/app/src/main/java/io/v/moments/ux/MainActivity.java b/projects/moments/app/src/main/java/io/v/moments/ux/MainActivity.java
index 9c9fea2..d6c17ed 100644
--- a/projects/moments/app/src/main/java/io/v/moments/ux/MainActivity.java
+++ b/projects/moments/app/src/main/java/io/v/moments/ux/MainActivity.java
@@ -34,24 +34,24 @@
 import java.util.concurrent.Executors;
 
 import io.v.moments.R;
-import io.v.moments.v23.ifc.Advertiser;
 import io.v.moments.ifc.Moment;
 import io.v.moments.ifc.MomentFactory;
-import io.v.moments.v23.ifc.Scanner;
 import io.v.moments.lib.DiscoveredList;
+import io.v.moments.lib.FileUtil;
 import io.v.moments.lib.Id;
 import io.v.moments.lib.ObservedList;
 import io.v.moments.lib.PermissionManager;
-import io.v.moments.v23.impl.V23ManagerImpl;
 import io.v.moments.model.AdConverterMoment;
 import io.v.moments.model.AdvertiserFactory;
 import io.v.moments.model.BitMapper;
 import io.v.moments.model.Config;
-import io.v.moments.lib.FileUtil;
 import io.v.moments.model.MomentFactoryImpl;
-import io.v.moments.v23.impl.ScannerImpl;
 import io.v.moments.model.StateStore;
 import io.v.moments.model.Toaster;
+import io.v.moments.v23.ifc.Advertiser;
+import io.v.moments.v23.ifc.Scanner;
+import io.v.moments.v23.ifc.V23Manager;
+import io.v.moments.v23.impl.V23ManagerImpl;
 import io.v.v23.security.Blessings;
 
 /**
@@ -81,9 +81,9 @@
  *
  * TODO: when reloading from prefs, don't change advertise or scan state. only
  * do that when reloading from bundle. TODO: ScannerImpl should handle the
- * Update parsing currently done by DiscoveredList. TODO: unit tests. TODO:
- * Add version number to prefs, ignore and overwrite state if old version (to
- * avoid need to manually wipe data to avoid crashes).
+ * Update parsing currently done by DiscoveredList. TODO: unit tests. TODO: Add
+ * version number to prefs, ignore and overwrite state if old version (to avoid
+ * need to manually wipe data to avoid crashes).
  */
 public class MainActivity extends AppCompatActivity {
     private static final String TAG = "MainActivity";
@@ -106,7 +106,7 @@
     // For changes to UX.
     private final Handler mHandler = new Handler(Looper.getMainLooper());
     // For discovery, serving and behaving as a client.
-    private final V23ManagerImpl mV23ManagerImpl = V23ManagerImpl.Singleton.get();
+    private final V23Manager mV23Manager = V23ManagerImpl.Singleton.get();
 
     // See wireUxToDataModel for discussion of the following.
     private StateStore mStateStore;
@@ -151,7 +151,7 @@
         // This will look in prefs for a Vanadium blessing, and if not
         // found will leave this activity (onStop likely to be called) and
         // return via a start intent (not via onActivityResult).
-        mV23ManagerImpl.init(this, onBlessings());
+        mV23Manager.init(this, onBlessings());
 
         wireUxToDataModel();
         initializeOrRestore(savedInstanceState);
@@ -189,7 +189,7 @@
         mBitMapper = Config.makeBitmapper(this);
 
         // Makes advertisers.  Needs v23Manager to do advertising.
-        mAdvertiserFactory = new AdvertiserFactory(mV23ManagerImpl);
+        mAdvertiserFactory = new AdvertiserFactory(mV23Manager);
 
         // Makes moments.  Each moment needs a bitmapper to read its BitMaps.
         mMomentFactory = new MomentFactoryImpl(mBitMapper);
@@ -202,7 +202,7 @@
         // for making RPCs to get photos, needs mHandler to post photos on the
         // UX thread, fills the cache with remote moments.
         AdConverterMoment converter = new AdConverterMoment(
-                mV23ManagerImpl, mMomentFactory, mPoolExecutor,
+                mV23Manager, mMomentFactory, mPoolExecutor,
                 mHandler, mRemoteMomentCache);
 
         // The list of remote (discovered) moments.  Pass mAdvertiserFactory
@@ -212,7 +212,8 @@
 
         Toaster toaster = new Toaster(this);
 
-        mScanner = new ScannerImpl(mV23ManagerImpl, Config.Discovery.QUERY);
+        mScanner = mV23Manager.makeScanner(
+                Config.Discovery.QUERY, Config.Discovery.DURATION);
         mScanSwitchHolder = new ScanSwitchHolder(
                 toaster, mScanner, mRemoteMoments);
 
@@ -349,7 +350,7 @@
             mScanner.stop();
         }
         stopAllAdvertising();
-        mV23ManagerImpl.shutdown();
+        mV23Manager.shutdown();
         Log.d(TAG, "Destruction complete.");
         Log.d(TAG, " ");
         Log.d(TAG, " ");
diff --git a/projects/moments/app/src/main/java/io/v/moments/v23/ifc/AdSupporter.java b/projects/moments/app/src/main/java/io/v/moments/v23/ifc/AdCampaign.java
similarity index 96%
rename from projects/moments/app/src/main/java/io/v/moments/v23/ifc/AdSupporter.java
rename to projects/moments/app/src/main/java/io/v/moments/v23/ifc/AdCampaign.java
index c5a65f6..e8a329a 100644
--- a/projects/moments/app/src/main/java/io/v/moments/v23/ifc/AdSupporter.java
+++ b/projects/moments/app/src/main/java/io/v/moments/v23/ifc/AdCampaign.java
@@ -11,7 +11,7 @@
 /**
  * Makes objects that support advertising.
  */
-public interface AdSupporter {
+public interface AdCampaign {
     /**
      * Makes an instance of a service that will be run during the life of the
      * advertisement.
diff --git a/projects/moments/app/src/main/java/io/v/moments/v23/ifc/Scanner.java b/projects/moments/app/src/main/java/io/v/moments/v23/ifc/Scanner.java
index 95c84c6..9c0f1cd 100644
--- a/projects/moments/app/src/main/java/io/v/moments/v23/ifc/Scanner.java
+++ b/projects/moments/app/src/main/java/io/v/moments/v23/ifc/Scanner.java
@@ -18,17 +18,16 @@
      *
      * Callbacks can be expected to run on the UX thread.
      *
-     * @param startupCallback    executed on success or failure of scan
-     *                           startup.
-     * @param updateCallback     executed on each scan update (each found or
-     *                           lost advertisement).
-     * @param completionCallback executed on success or failure of scan
-     *                           completion.  A scan might shutdown for reasons
-     *                           other than a call to stop, e.g. a timeout.
+     * @param onStart  executed on success or failure of scan startup.
+     * @param onUpdate executed on each scan update (each found or lost
+     *                 advertisement).
+     * @param onStop   executed on success or failure of scan completion.  A
+     *                 scan might shutdown for reasons other than a call to
+     *                 stop, e.g. a timeout.
      */
-    void start(FutureCallback<Void> startupCallback,
-               InputChannelCallback<Update> updateCallback,
-               FutureCallback<Void> completionCallback);
+    void start(FutureCallback<Void> onStart,
+               InputChannelCallback<Update> onUpdate,
+               FutureCallback<Void> onStop);
 
     /**
      * True if stop could usefully be called.
diff --git a/projects/moments/app/src/main/java/io/v/moments/v23/ifc/V23Manager.java b/projects/moments/app/src/main/java/io/v/moments/v23/ifc/V23Manager.java
index e694025..cb0ccfe 100644
--- a/projects/moments/app/src/main/java/io/v/moments/v23/ifc/V23Manager.java
+++ b/projects/moments/app/src/main/java/io/v/moments/v23/ifc/V23Manager.java
@@ -12,37 +12,43 @@
 
 import java.util.List;
 
-import io.v.v23.InputChannelCallback;
 import io.v.v23.context.VContext;
-import io.v.v23.discovery.Update;
 import io.v.v23.security.BlessingPattern;
 import io.v.v23.security.Blessings;
-import io.v.v23.verror.VException;
 
 /**
  * V23 functionality; service creation and discovery.
  */
 public interface V23Manager {
-    void init(
-            Activity activity, FutureCallback<Blessings> blessingCallback);
+    /**
+     * Start V23 runtime bound to the given activity, and give it a callback via
+     * which it will get its blessings.
+     */
+    void init(Activity activity,
+              FutureCallback<Blessings> blessingCallback);
 
+    /**
+     * Shutdown the v23 runtime.  This should be called in onDestroy to clean up
+     * any lingering contexts associated with advertising or scanning.
+     */
     void shutdown();
 
-    void scan(
-            String query,
-            Duration duration,
-            FutureCallback<VContext> startupCallback,
-            InputChannelCallback<Update> updateCallback,
-            FutureCallback<Void> completionCallback);
+    /**
+     * Used to construct RPCs.
+     */
+    VContext contextWithTimeout(Duration timeout);
 
-    Advertiser makeAdvertiser(AdSupporter adSupporter,
+    /**
+     * Returns an advertiser that will start advertising using the adCampaign
+     * for a fixed time duration.
+     */
+    Advertiser makeAdvertiser(AdCampaign adCampaign,
                               Duration duration,
                               List<BlessingPattern> visibility);
 
-    VContext makeServerContext(
-            String mountName, Object server) throws VException;
-
-    VContext contextWithTimeout(Duration timeout);
-
-    List<String> makeServerAddressList(VContext serverCtx);
+    /**
+     * Returns a scanner that will look for advertisements matching the query,
+     * for a fixed time duration.
+     */
+    Scanner makeScanner(String query, Duration duration);
 }
diff --git a/projects/moments/app/src/main/java/io/v/moments/v23/impl/ScannerImpl.java b/projects/moments/app/src/main/java/io/v/moments/v23/impl/ScannerImpl.java
deleted file mode 100644
index 7ff1c4b..0000000
--- a/projects/moments/app/src/main/java/io/v/moments/v23/impl/ScannerImpl.java
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2015 The Vanadium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package io.v.moments.v23.impl;
-
-import android.util.Log;
-
-import com.google.common.util.concurrent.FutureCallback;
-
-import io.v.moments.model.Config;
-import io.v.moments.v23.ifc.Scanner;
-import io.v.moments.v23.ifc.V23Manager;
-import io.v.v23.InputChannelCallback;
-import io.v.v23.context.VContext;
-import io.v.v23.discovery.Update;
-
-/**
- * Handles scanning for moments.
- *
- * This class similar to AdvertiserImpl - see that class for more commentary -
- * in that it functions as decoupling of the UX from the moving target that is
- * the V23Manager/VContext API
- *
- * At the moment, the complexity is far less than it is for advertising
- * (scanning doesn't require a running service), so this class doesn't add much
- * value over using an instance of V23ManagerImpl and VContext directly in whatever
- * class uses a Scanner.  To make this class more useful in decoupling moments
- * specific code from v23 specifics, this class could tease apart a scan Update,
- * and feed advertisement data from the Update.Found and Update.Lost object
- * directly into, say, the appropriate instances of java.util.function.Consumer<T>
- * that were passed to #start en lieu of the InputChannelCallback<Update>
- * updateCallback.  That way the caller would have no exposure to v23 classes.
- */
-public class ScannerImpl implements Scanner {
-    private static final String TAG = "ScannerImpl";
-    private final V23Manager mV23Manager;
-    private final String mQuery;
-    private VContext mScanCtx;
-
-    public ScannerImpl(V23Manager v23Manager, String query) {
-        if (v23Manager == null) {
-            throw new IllegalArgumentException("Null v23Manager.");
-        }
-        if (query == null || query.isEmpty()) {
-            throw new IllegalArgumentException("Empty query.");
-        }
-        mV23Manager = v23Manager;
-        mQuery = query;
-    }
-
-    @Override
-    public String toString() {
-        return "scan(" + mQuery + "," + isScanning() + ")";
-    }
-
-    /**
-     * Accepts the scanning context on success (or assures that it's null on
-     * failure), then activates the callback supplied by the client (likely to
-     * change the UX).
-     */
-    private FutureCallback<VContext> makeWrapped(
-            final FutureCallback<Void> startup) {
-        return new FutureCallback<VContext>() {
-            @Override
-            public void onSuccess(VContext context) {
-                mScanCtx = context;
-                startup.onSuccess(null);
-            }
-
-            @Override
-            public void onFailure(final Throwable t) {
-                mScanCtx = null;
-                startup.onFailure(t);
-            }
-        };
-    }
-
-    @Override
-    public void start(
-            FutureCallback<Void> startupCallback,
-            InputChannelCallback<Update> updateCallback,
-            FutureCallback<Void> completionCallback) {
-        Log.d(TAG, "Entering start.");
-        if (isScanning()) {
-            startupCallback.onFailure(
-                    new IllegalStateException("Already scanning."));
-            return;
-        }
-        mV23Manager.scan(
-                mQuery, Config.Discovery.DURATION,
-                makeWrapped(startupCallback),
-                updateCallback,
-                completionCallback);
-        Log.d(TAG, "Exiting start.");
-    }
-
-    @Override
-    public boolean isScanning() {
-        return mScanCtx != null && !mScanCtx.isCanceled();
-    }
-
-    @Override
-    public void stop() {
-        Log.d(TAG, "Entering stop");
-        if (mScanCtx != null) {
-            Log.d(TAG, "Cancelling scan.");
-            if (!mScanCtx.isCanceled()) {
-                mScanCtx.cancel();
-            }
-            mScanCtx = null;
-        }
-        Log.d(TAG, "Exiting stop");
-    }
-}
diff --git a/projects/moments/app/src/main/java/io/v/moments/v23/impl/V23ManagerImpl.java b/projects/moments/app/src/main/java/io/v/moments/v23/impl/V23ManagerImpl.java
index fd88155..063388b 100644
--- a/projects/moments/app/src/main/java/io/v/moments/v23/impl/V23ManagerImpl.java
+++ b/projects/moments/app/src/main/java/io/v/moments/v23/impl/V23ManagerImpl.java
@@ -19,8 +19,9 @@
 
 import io.v.android.libs.security.BlessingsManager;
 import io.v.android.v23.V;
-import io.v.moments.v23.ifc.AdSupporter;
+import io.v.moments.v23.ifc.AdCampaign;
 import io.v.moments.v23.ifc.Advertiser;
+import io.v.moments.v23.ifc.Scanner;
 import io.v.moments.v23.ifc.V23Manager;
 import io.v.v23.InputChannelCallback;
 import io.v.v23.InputChannels;
@@ -34,13 +35,13 @@
 import io.v.v23.verror.VException;
 
 /**
- * Various static V23Manager utilities gathered into an instantiatable class.
+ * Various static V23 utilities gathered into an instantiatable class.
  *
- * This allows v23 usage to be injected and mocked.  The class is a singleton to
+ * This allows V23 usage to be injected and mocked.  The class is a singleton to
  * avoid confusion about init, shutdown and the 'base context'.
  *
- * Nothing in here has anything in particular to do with Moments; its generic
- * code that hides an evolving, static API.
+ * Nothing in here has anything in particular to do with Moments; it's an object
+ * hiding an evolving API based on static functions.
  */
 public class V23ManagerImpl implements V23Manager {
     private static final String TAG = "V23ManagerImpl";
@@ -54,34 +55,6 @@
     }
 
     @Override
-    public void scan(
-            String query,
-            Duration duration,
-            FutureCallback<VContext> startupCallback,
-            InputChannelCallback<Update> updateCallback,
-            FutureCallback<Void> completionCallback) {
-        Log.d(TAG, "Starting scan with q=[" + query + "]");
-        if (mDiscovery == null) {
-            startupCallback.onFailure(
-                    new IllegalStateException("Discovery not ready."));
-            return;
-        }
-        VContext context = contextWithTimeout(duration);
-        Futures.addCallback(
-                InputChannels.withCallback(
-                        mDiscovery.scan(context, query), updateCallback),
-                completionCallback);
-        startupCallback.onSuccess(context);
-    }
-
-    @Override
-    public Advertiser makeAdvertiser(AdSupporter adSupporter,
-                                     Duration duration,
-                                     List<BlessingPattern> visibility) {
-        return new AdvertiserImpl(adSupporter, duration, visibility);
-    }
-
-    @Override
     public synchronized void init(
             Activity activity, FutureCallback<Blessings> blessingCallback) {
         Log.d(TAG, "init");
@@ -120,8 +93,7 @@
         mAndroidCtx = null;
     }
 
-    @Override
-    public VContext makeServerContext(
+    private VContext makeServerContext(
             String mountName, Object server) throws VException {
         return V.withNewServer(
                 mV23Ctx.withCancel(),
@@ -130,8 +102,7 @@
                 VSecurity.newAllowEveryoneAuthorizer());
     }
 
-    @Override
-    public List<String> makeServerAddressList(VContext serverCtx) {
+    private List<String> makeServerAddressList(VContext serverCtx) {
         List<String> addresses = new ArrayList<>();
         Endpoint[] points = V.getServer(
                 serverCtx).getStatus().getEndpoints();
@@ -146,6 +117,18 @@
         return mV23Ctx.withTimeout(timeout);
     }
 
+    @Override
+    public Advertiser makeAdvertiser(AdCampaign adCampaign,
+                                     Duration duration,
+                                     List<BlessingPattern> visibility) {
+        return new AdvertiserImpl(adCampaign, duration, visibility);
+    }
+
+    @Override
+    public Scanner makeScanner(String query, Duration duration) {
+        return new ScannerImpl(query, duration);
+    }
+
     public static class Singleton {
         private static volatile V23ManagerImpl instance;
 
@@ -172,7 +155,7 @@
     class AdvertiserImpl implements Advertiser {
         private static final String TAG = "AdvertiserImpl";
 
-        private final AdSupporter mAdSupporter;
+        private final AdCampaign mAdCampaign;
         private final Duration mDuration;
         private final List<BlessingPattern> mVisibility;
 
@@ -180,11 +163,11 @@
         private VContext mServerCtx;
 
         public AdvertiserImpl(
-                AdSupporter adSupporter,
+                AdCampaign adCampaign,
                 Duration duration,
                 List<BlessingPattern> visibility) {
-            if (adSupporter == null) {
-                throw new IllegalArgumentException("Null adSupporter");
+            if (adCampaign == null) {
+                throw new IllegalArgumentException("Null adCampaign");
             }
             if (duration == null) {
                 throw new IllegalArgumentException("Null duration");
@@ -192,7 +175,7 @@
             if (visibility == null) {
                 throw new IllegalArgumentException("Null visibility");
             }
-            mAdSupporter = adSupporter;
+            mAdCampaign = adCampaign;
             mDuration = duration;
             mVisibility = visibility;
         }
@@ -215,8 +198,8 @@
 
             try {
                 mServerCtx = makeServerContext(
-                        mAdSupporter.getMountName(),
-                        mAdSupporter.makeServer());
+                        mAdCampaign.getMountName(),
+                        mAdCampaign.makeServer());
             } catch (VException e) {
                 onStartCallback.onFailure(
                         new IllegalStateException("Unable to start service.", e));
@@ -229,7 +212,7 @@
             ListenableFuture<ListenableFuture<Void>> nestedFuture =
                     mDiscovery.advertise(
                             context,
-                            mAdSupporter.makeAdvertisement(
+                            mAdCampaign.makeAdvertisement(
                                     makeServerAddressList(mServerCtx)),
                             mVisibility);
 
@@ -328,4 +311,87 @@
             }
         }
     }
+
+    /**
+     * Handles scanning for moments.
+     *
+     * To make this class more useful in decoupling moments specific code from
+     * v23 specifics, this class could tease apart a scan Update, and feed
+     * advertisement data from the Update.Found and Update.Lost object directly
+     * into, say, the appropriate instances of java.util.function.Consumer<T>
+     * that were passed to #start en lieu of the InputChannelCallback<Update>
+     * updateCallback.  That way the caller would have no exposure to v23
+     * classes (Update and Lost).
+     */
+    class ScannerImpl implements Scanner {
+        private static final String TAG = "ScannerImpl";
+        private final String mQuery;
+        private final Duration mDuration;
+        private VContext mScanCtx;
+
+        public ScannerImpl(String query, Duration duration) {
+            if (query == null || query.isEmpty()) {
+                throw new IllegalArgumentException("Empty query.");
+            }
+            if (duration == null) {
+                throw new IllegalArgumentException("Null duration.");
+            }
+            mDuration = duration;
+            mQuery = query;
+        }
+
+        @Override
+        public String toString() {
+            return "scan(" + mQuery + "," + isScanning() + ")";
+        }
+
+        @Override
+        public void start(
+                FutureCallback<Void> onStart,
+                InputChannelCallback<Update> onUpdate,
+                FutureCallback<Void> onStop) {
+            Log.d(TAG, "Entering start.");
+            if (isScanning()) {
+                onStart.onFailure(
+                        new IllegalStateException("Already scanning."));
+                return;
+            }
+
+            Log.d(TAG, "Starting scan with q=[" + mQuery + "]");
+            if (mDiscovery == null) {
+                onStart.onFailure(
+                        new IllegalStateException("Discovery not ready."));
+                return;
+            }
+
+            mScanCtx = contextWithTimeout(mDuration);
+
+            Futures.addCallback(
+                    InputChannels.withCallback(
+                            mDiscovery.scan(mScanCtx, mQuery), onUpdate),
+                    onStop);
+
+            onStart.onSuccess(null);
+
+            Log.d(TAG, "Exiting start.");
+        }
+
+        @Override
+        public boolean isScanning() {
+            return mScanCtx != null && !mScanCtx.isCanceled();
+        }
+
+        @Override
+        public void stop() {
+            Log.d(TAG, "Entering stop");
+            if (mScanCtx != null) {
+                Log.d(TAG, "Cancelling scan.");
+                if (!mScanCtx.isCanceled()) {
+                    mScanCtx.cancel();
+                }
+                mScanCtx = null;
+            }
+            Log.d(TAG, "Exiting stop");
+        }
+    }
 }
diff --git a/projects/moments/app/src/test/java/io/v/moments/model/AdvertiserFactoryTest.java b/projects/moments/app/src/test/java/io/v/moments/model/AdvertiserFactoryTest.java
index 1892345..4dfeafc 100644
--- a/projects/moments/app/src/test/java/io/v/moments/model/AdvertiserFactoryTest.java
+++ b/projects/moments/app/src/test/java/io/v/moments/model/AdvertiserFactoryTest.java
@@ -22,7 +22,7 @@
 
 import io.v.moments.ifc.Moment;
 import io.v.moments.lib.Id;
-import io.v.moments.v23.ifc.AdSupporter;
+import io.v.moments.v23.ifc.AdCampaign;
 import io.v.moments.v23.ifc.Advertiser;
 import io.v.moments.v23.ifc.V23Manager;
 import io.v.v23.security.BlessingPattern;
@@ -45,7 +45,7 @@
     public ExpectedException mThrown = ExpectedException.none();
 
     @Captor
-    ArgumentCaptor<MomentAdSupporter> mSupporter;
+    ArgumentCaptor<MomentAdCampaign> mSupporter;
     @Captor
     ArgumentCaptor<Duration> mDuration;
     @Captor
@@ -66,7 +66,7 @@
     public void setup() throws Exception {
         mFactory = new AdvertiserFactory(mV23Manager);
         when(mV23Manager.makeAdvertiser(
-                any(AdSupporter.class),
+                any(AdCampaign.class),
                 eq(Config.Discovery.DURATION),
                 eq(Config.Discovery.NO_PATTERNS)
         )).thenReturn(mAdvertiser0);
@@ -98,7 +98,7 @@
 
         when(mMoment.getId()).thenReturn(ID1);
         when(mV23Manager.makeAdvertiser(
-                any(AdSupporter.class),
+                any(AdCampaign.class),
                 eq(Config.Discovery.DURATION),
                 eq(Config.Discovery.NO_PATTERNS)
         )).thenReturn(mAdvertiser1);