* The Sone to insert
*/
public SoneInserter(Core core, EventBus eventBus, FreenetInterface freenetInterface, Sone sone) {
+ this(core, eventBus, freenetInterface, sone, new SoneModificationDetector(core, sone, insertionDelay));
+ }
+
+ @VisibleForTesting
+ SoneInserter(Core core, EventBus eventBus, FreenetInterface freenetInterface, Sone sone, SoneModificationDetector soneModificationDetector) {
super("Sone Inserter for “" + sone.getName() + "”", false);
this.core = core;
this.eventBus = eventBus;
this.freenetInterface = freenetInterface;
this.sone = sone;
- this.soneModificationDetector = new SoneModificationDetector(core, sone, insertionDelay);
+ this.soneModificationDetector = soneModificationDetector;
}
//
* @return This Sone inserter
*/
public SoneInserter setSone(Sone sone) {
- checkArgument((this.sone == null) || sone.equals(this.sone), "Sone to insert can not be set to a different Sone");
+ checkArgument(sone.equals(this.sone), "Sone to insert can not be set to a different Sone");
this.sone = sone;
return this;
}