diff --git a/src/main/java/de/anxietyprime/swajodel/Routes.java b/src/main/java/de/anxietyprime/swajodel/Routes.java index 79a9b24..fa19a91 100644 --- a/src/main/java/de/anxietyprime/swajodel/Routes.java +++ b/src/main/java/de/anxietyprime/swajodel/Routes.java @@ -119,9 +119,9 @@ public class Routes { } // calculate anonymous IDs for the posts + Vector anonymousIDs = new Vector(); + anonymousIDs.add(userID); posts.forEach(post -> { - Vector anonymousIDs = new Vector(); - anonymousIDs.add(userID); post.anonymize(anonymousIDs); }); diff --git a/src/test/java/de/anxietyprime/swajodel/SwaJodelApplicationTests.java b/src/test/java/de/anxietyprime/swajodel/SwaJodelApplicationTests.java index 67b157d..d378202 100644 --- a/src/test/java/de/anxietyprime/swajodel/SwaJodelApplicationTests.java +++ b/src/test/java/de/anxietyprime/swajodel/SwaJodelApplicationTests.java @@ -8,39 +8,4 @@ import java.util.Vector; @SpringBootTest class SwaJodelApplicationTests { - @Test - void anonymousTest() { - JodelPost post = new JodelPost(1000); - post.comments.add(new JodelPost(1001)); - post.comments.add(new JodelPost(1002)); - post.comments.get(0).comments.add(new JodelPost(1000)); - post.comments.get(0).comments.add(new JodelPost(1001)); - post.comments.get(0).comments.add(new JodelPost(1000)); - post.comments.add(new JodelPost(1003)); - post.comments.get(2).comments.add(new JodelPost(1001)); - post.comments.get(2).comments.add(new JodelPost(1002)); - post.comments.get(2).comments.add(new JodelPost(1003)); - post.comments.get(2).comments.add(new JodelPost(1000)); - post.comments.add(new JodelPost(1000)); - post.comments.add(new JodelPost(1001)); - post.comments.add(new JodelPost(1001)); - - post.anonymize(new Vector()); - - assert (post.anonymousID == 0); - assert (post.comments.get(0).anonymousID == 1); - assert (post.comments.get(1).anonymousID == 2); - assert (post.comments.get(2).anonymousID == 3); - assert (post.comments.get(3).anonymousID == 0); - assert (post.comments.get(4).anonymousID == 1); - assert (post.comments.get(5).anonymousID == 1); - assert (post.comments.get(0).comments.get(0).anonymousID == 0); - assert (post.comments.get(0).comments.get(1).anonymousID == 1); - assert (post.comments.get(0).comments.get(2).anonymousID == 0); - assert (post.comments.get(2).comments.get(0).anonymousID == 1); - assert (post.comments.get(2).comments.get(1).anonymousID == 2); - assert (post.comments.get(2).comments.get(2).anonymousID == 3); - assert (post.comments.get(2).comments.get(3).anonymousID == 0); - } - }