1 package net.pterodactylus.sone.data.impl;
3 import static org.mockito.Mockito.mock;
5 import net.pterodactylus.sone.data.Sone;
6 import net.pterodactylus.sone.freenet.wot.Identity;
7 import net.pterodactylus.sone.freenet.wot.OwnIdentity;
12 * Unit test for {@link AbstractSoneBuilder}.
14 public class AbstractSoneBuilderTest {
16 private final AbstractSoneBuilder soneBuilder = new AbstractSoneBuilder() {
18 public Sone build() throws IllegalStateException {
25 public void localSoneIsValidated() {
26 Identity ownIdentity = mock(OwnIdentity.class);
27 soneBuilder.local().from(ownIdentity).build();
30 @Test(expected = IllegalStateException.class)
31 public void localSoneIsNotValidatedIfIdentityIsNotAnOwnIdentity() {
32 Identity identity = mock(Identity.class);
33 soneBuilder.local().from(identity).build();
36 @Test(expected = IllegalStateException.class)
37 public void localSoneIsNotValidatedIfIdentityIsNull() {
38 soneBuilder.local().build();
42 public void removeSoneIsValidate() {
43 Identity identity = mock(Identity.class);
44 soneBuilder.from(identity).build();
47 @Test(expected = IllegalStateException.class)
48 public void remoteSoneIsNotValidatedIfIdentityIsNull() {