Changeset View
Changeset View
Standalone View
Standalone View
src/test/java/net/wildfyre/posts/PostTest.java
/* | /* | ||||
* Copyright 2018 Wildfyre.net | * Copyright 2019 Wildfyre.net | ||||
* | * | ||||
* Licensed under the Apache License, Version 2.0 (the "License"); | * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
* you may not use this file except in compliance with the License. | * you may not use this file except in compliance with the License. | ||||
* You may obtain a copy of the License at | * You may obtain a copy of the License at | ||||
* | * | ||||
* http://www.apache.org/licenses/LICENSE-2.0 | * http://www.apache.org/licenses/LICENSE-2.0 | ||||
* | * | ||||
* Unless required by applicable law or agreed to in writing, software | * Unless required by applicable law or agreed to in writing, software | ||||
Show All 20 Lines | public class PostTest { | ||||
@Before | @Before | ||||
public void before() { | public void before() { | ||||
RequestTest.Companion.connectToTestDB(); | RequestTest.Companion.connectToTestDB(); | ||||
} | } | ||||
@Test | @Test | ||||
public void myPosts(){ | public void myPosts(){ | ||||
List<Post> posts = Users.me() | List<Post> posts = Users.INSTANCE.me() | ||||
.asLogged() | .asLogged() | ||||
.postsList(); | .getPostsList(); | ||||
assertEquals(3, posts.size()); | assertEquals(3, posts.size()); | ||||
Post p1 = posts.get(0); | Post p1 = posts.get(0); | ||||
assertFalse(p1.isAnonymous()); | assertFalse(p1.isAnonymous()); | ||||
assertTrue(p1.hasSubscribed()); | assertTrue(p1.hasSubscribed()); | ||||
assertTrue(p1.isActive()); | assertTrue(p1.isActive()); | ||||
assertTrue(p1.author().isPresent()); | assertTrue(p1.author().isPresent()); | ||||
assertEquals(Users.me(), p1.author().get()); | assertEquals(Users.INSTANCE.me(), p1.author().get()); | ||||
Post p2 = posts.get(1); | Post p2 = posts.get(1); | ||||
assertTrue(p2.isAnonymous()); | assertTrue(p2.isAnonymous()); | ||||
assertTrue(p2.hasSubscribed()); | assertTrue(p2.hasSubscribed()); | ||||
assertTrue(p2.isActive()); | assertTrue(p2.isActive()); | ||||
assertFalse(p2.author().isPresent()); | assertFalse(p2.author().isPresent()); | ||||
} | } | ||||
Show All 16 Lines |