X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2Fimpl%2FAbstractSoneBuilderTest.java;h=927148fadb8d64790366cbcbea6a84e7ccbeee4e;hp=8c9e1a9e7b5b652fb9b23d0dfadd7cc5ecc56dde;hb=f8672b1385173a103d7f085d8e9cd43bc5762d71;hpb=79c49c4bf6b1fef8b6696ca9e5ba615e1996f5e6 diff --git a/src/test/java/net/pterodactylus/sone/data/impl/AbstractSoneBuilderTest.java b/src/test/java/net/pterodactylus/sone/data/impl/AbstractSoneBuilderTest.java index 8c9e1a9..927148f 100644 --- a/src/test/java/net/pterodactylus/sone/data/impl/AbstractSoneBuilderTest.java +++ b/src/test/java/net/pterodactylus/sone/data/impl/AbstractSoneBuilderTest.java @@ -3,6 +3,7 @@ package net.pterodactylus.sone.data.impl; import static org.mockito.Mockito.mock; import net.pterodactylus.sone.data.Client; +import net.pterodactylus.sone.data.LocalSone; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.freenet.wot.Identity; import net.pterodactylus.sone.freenet.wot.OwnIdentity; @@ -22,24 +23,30 @@ public class AbstractSoneBuilderTest { validate(); return null; } + + @Override + public LocalSone buildLocal() throws IllegalStateException { + validateLocal(); + 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).using(client).build(); + soneBuilder.from(ownIdentity).lastUpdated(1).using(client).buildLocal(); } @Test(expected = IllegalStateException.class) public void localSoneIsNotValidatedIfIdentityIsNotAnOwnIdentity() { Identity identity = mock(Identity.class); - soneBuilder.local().from(identity).lastUpdated(1).using(client).build(); + soneBuilder.from(identity).lastUpdated(1).using(client).buildLocal(); } @Test(expected = IllegalStateException.class) public void localSoneIsNotValidatedIfIdentityIsNull() { - soneBuilder.local().lastUpdated(1).using(client).build(); + soneBuilder.lastUpdated(1).using(client).buildLocal(); } @Test @@ -56,7 +63,7 @@ public class AbstractSoneBuilderTest { @Test(expected = IllegalStateException.class) public void localSoneIsNotValidatedWithoutUpdateTime() { Identity identity = mock(OwnIdentity.class); - soneBuilder.from(identity).local().using(client).build(); + soneBuilder.from(identity).using(client).buildLocal(); } @Test(expected = IllegalStateException.class) @@ -68,7 +75,7 @@ public class AbstractSoneBuilderTest { @Test(expected = IllegalStateException.class) public void localSoneIsNotValidatedWithoutClient() { Identity identity = mock(OwnIdentity.class); - soneBuilder.from(identity).local().lastUpdated(1L).build(); + soneBuilder.from(identity).lastUpdated(1L).buildLocal(); } @Test(expected = IllegalStateException.class)