import static org.mockito.Mockito.when;
import net.pterodactylus.sone.core.Core;
+import net.pterodactylus.sone.data.LocalSone;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.freenet.SimpleFieldSetBuilder;
import net.pterodactylus.sone.freenet.fcp.Command.Response;
@Test
public void testLockingALocalSone() throws FcpException {
- Sone localSone = mock(Sone.class);
+ LocalSone localSone = mock(LocalSone.class);
when(localSone.getId()).thenReturn("LocalSone");
when(localSone.isLocal()).thenReturn(true);
Core core = mock(Core.class);
- when(core.getSone(eq("LocalSone"))).thenReturn(Optional.of(localSone));
- when(core.getLocalSone(eq("LocalSone"))).thenReturn(localSone);
+ when(core.getSone(eq("LocalSone"))).thenReturn(Optional.<Sone>of(localSone));
+ when(core.getLocalSone(eq("LocalSone"))).thenReturn(Optional.of(localSone));
SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "LocalSone").get();
LockSoneCommand lockSoneCommand = new LockSoneCommand(core);
@Test(expected = FcpException.class)
public void testLockingARemoteSone() throws FcpException {
- Sone removeSone = mock(Sone.class);
+ Sone remoteSone = mock(Sone.class);
Core core = mock(Core.class);
- when(core.getSone(eq("RemoteSone"))).thenReturn(Optional.of(removeSone));
+ when(core.getSone(eq("RemoteSone"))).thenReturn(Optional.of(remoteSone));
SimpleFieldSet fields = new SimpleFieldSetBuilder().put("Sone", "RemoteSone").get();
LockSoneCommand lockSoneCommand = new LockSoneCommand(core);