import freenet.support.SimpleFieldSet;
+import com.google.common.base.Optional;
import org.junit.Test;
/**
public void testUnlockingALocalSone() throws FcpException {
Sone localSone = mock(Sone.class);
when(localSone.getId()).thenReturn("LocalSone");
+ when(localSone.isLocal()).thenReturn(true);
Core core = mock(Core.class);
- when(core.getSone(eq("LocalSone"), anyBoolean())).thenReturn(localSone);
+ when(core.getSone(eq("LocalSone"))).thenReturn(Optional.of(localSone));
when(core.getLocalSone(eq("LocalSone"), anyBoolean())).thenReturn(localSone);
SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "LocalSone").get();
public void testUnlockingARemoteSone() throws FcpException {
Sone removeSone = mock(Sone.class);
Core core = mock(Core.class);
- when(core.getSone(eq("RemoteSone"), anyBoolean())).thenReturn(removeSone);
+ when(core.getSone(eq("RemoteSone"))).thenReturn(Optional.of(removeSone));
SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "RemoteSone").get();
UnlockSoneCommand unlockSoneCommand = new UnlockSoneCommand(core);