import static org.mockito.Mockito.mock;
+import net.pterodactylus.sone.data.Client;
import net.pterodactylus.sone.data.Sone;
import net.pterodactylus.sone.freenet.wot.Identity;
import net.pterodactylus.sone.freenet.wot.OwnIdentity;
return null;
}
};
+ private final Client client = new Client("Test Client", "1.0");
@Test
public void localSoneIsValidated() {
Identity ownIdentity = mock(OwnIdentity.class);
- soneBuilder.local().from(ownIdentity).lastUpdated(1).build();
+ soneBuilder.local().from(ownIdentity).lastUpdated(1).using(client).build();
}
@Test(expected = IllegalStateException.class)
public void localSoneIsNotValidatedIfIdentityIsNotAnOwnIdentity() {
Identity identity = mock(Identity.class);
- soneBuilder.local().from(identity).lastUpdated(1).build();
+ soneBuilder.local().from(identity).lastUpdated(1).using(client).build();
}
@Test(expected = IllegalStateException.class)
public void localSoneIsNotValidatedIfIdentityIsNull() {
- soneBuilder.local().lastUpdated(1).build();
+ soneBuilder.local().lastUpdated(1).using(client).build();
}
@Test
public void remoteSoneIsValidated() {
Identity identity = mock(Identity.class);
- soneBuilder.from(identity).lastUpdated(1).build();
+ soneBuilder.from(identity).lastUpdated(1).using(client).build();
}
@Test(expected = IllegalStateException.class)
public void remoteSoneIsNotValidatedIfIdentityIsNull() {
- soneBuilder.lastUpdated(1).build();
+ soneBuilder.lastUpdated(1).using(client).build();
}
@Test(expected = IllegalStateException.class)
public void localSoneIsNotValidatedWithoutUpdateTime() {
Identity identity = mock(OwnIdentity.class);
- soneBuilder.from(identity).local().build();
+ soneBuilder.from(identity).local().using(client).build();
}
@Test(expected = IllegalStateException.class)
public void remoteSoneIsNotValidatedWithoutUpdateTime() {
Identity identity = mock(Identity.class);
- soneBuilder.from(identity).build();
+ soneBuilder.from(identity).using(client).build();
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void localSoneIsNotValidatedWithoutClient() {
+ Identity identity = mock(OwnIdentity.class);
+ soneBuilder.from(identity).local().lastUpdated(1L).build();
+ }
+
+ @Test(expected = IllegalStateException.class)
+ public void remoteSoneIsNotValidatedWithoutClient() {
+ Identity identity = mock(Identity.class);
+ soneBuilder.from(identity).lastUpdated(1L).build();
}
}