Change some PageCacheHandlerTest methods

This commit is contained in:
Fuzzlemann 2017-08-15 13:04:59 +02:00
parent 8eff9720ba
commit ad2a3d80ae
2 changed files with 15 additions and 4 deletions

View File

@ -60,7 +60,7 @@ public class AnalysisCacheHandler {
* @return true if there is data in the cache.
*/
public boolean isCached() {
return (cache != null);
return cache != null;
}
/**

View File

@ -4,6 +4,7 @@ import main.java.com.djrapitops.plan.data.cache.PageCacheHandler;
import main.java.com.djrapitops.plan.data.cache.PageLoader;
import main.java.com.djrapitops.plan.ui.webserver.response.Response;
import org.junit.Test;
import test.java.utils.RandomData;
import static junit.framework.TestCase.*;
@ -11,13 +12,23 @@ import static junit.framework.TestCase.*;
* @author Fuzzlemann
*/
public class PageCacheHandlerTest {
private final String IDENTIFIER = "test";
private final PageLoader LOADER = () -> new Response() {
private final String IDENTIFIER = RandomData.randomString(10);
private final String RESPONSE_STRING = RandomData.randomString(10);
private final Response RESPONSE = new Response() {
@Override
public String getResponse() {
return "Test";
return RESPONSE_STRING;
}
};
private final PageLoader LOADER = () -> RESPONSE;
@Test
public void testCreateResponse() {
String expResponse = RESPONSE.getResponse();
String response = LOADER.createResponse().getResponse();
assertEquals(expResponse, response);
}
@Test
public void testCache() {