Refactored tests.

This commit is contained in:
Christian P. MOMON 2019-05-03 01:59:18 +02:00
parent 90c739ed07
commit 8346f211f9
4 changed files with 73 additions and 32 deletions

View File

@ -21,7 +21,7 @@ package org.april.hebdobot.pastebin;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
/** /**
* The Class IdenticaSettings. * The Class PatebinSettings.
*/ */
public class PastebinSettings public class PastebinSettings
{ {

View File

@ -0,0 +1,63 @@
/**
* Copyright (C) 2018-2019 Christian Pierre MOMON <cmomon@april.org>
*
* This file is part of (April) Hebdobot.
*
* Hebdobot is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Hebdobot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/
package org.april.hebdobot.bot.stats;
import java.io.File;
import org.apache.log4j.BasicConfigurator;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* The Class ReviewDatasFileTest.
*/
public class ReviewDatasFileTest
{
private static final Logger logger = LoggerFactory.getLogger(ReviewDatasFileTest.class);
/**
* Test load.
*
* @throws Exception
* the exception
*/
@Test
public void testLoad() throws Exception
{
System.out.println("================");
ReviewDatas datas = ReviewDatasFile.load(new File("test/org/april/hebdobot/bot/stats/reviewstats.csv"));
for (ReviewData data : datas)
{
System.out.println(data.toString());
}
}
/**
* Inits the.
*/
@BeforeClass
public static void init()
{
BasicConfigurator.configure();
logger.info("Basic log configuration done.");
}
}

View File

@ -16,17 +16,13 @@
* You should have received a copy of the GNU Affero General Public License * You should have received a copy of the GNU Affero General Public License
* along with Hebdobot. If not, see <http://www.gnu.org/licenses/> * along with Hebdobot. If not, see <http://www.gnu.org/licenses/>
*/ */
package org.april.hebdobot.reviewstats; package org.april.hebdobot.bot.stats;
import java.io.File; import java.io.File;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.BasicConfigurator; import org.apache.log4j.BasicConfigurator;
import org.april.hebdobot.bot.stats.ReviewData;
import org.april.hebdobot.bot.stats.ReviewDatas;
import org.april.hebdobot.bot.stats.ReviewDatasFile;
import org.april.hebdobot.bot.stats.ReviewStatsReporter;
import org.junit.Assert; import org.junit.Assert;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@ -34,29 +30,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
/** /**
* The Class ReviewStatsTest. * The Class ReviewStatsReporterTest.
*/ */
public class ReviewStatsTest public class ReviewStatsReporterTest
{ {
private static final Logger logger = LoggerFactory.getLogger(ReviewStatsTest.class); private static final Logger logger = LoggerFactory.getLogger(ReviewStatsReporterTest.class);
/**
* Test load.
*
* @throws Exception
* the exception
*/
@Test
public void testLoad() throws Exception
{
System.out.println("================");
ReviewDatas datas = ReviewDatasFile.load(new File("test/org/april/hebdobot/reviewstats/reviewstats.csv"));
for (ReviewData data : datas)
{
System.out.println(data.toString());
}
}
/** /**
* Test report duration. * Test report duration.
@ -65,10 +43,10 @@ public class ReviewStatsTest
* the exception * the exception
*/ */
@Test @Test
public void testReportDuration() throws Exception public void testReportDuration01() throws Exception
{ {
System.out.println("================"); System.out.println("================");
ReviewDatas datas = ReviewDatasFile.load(new File("test/org/april/hebdobot/reviewstats/reviewstats.csv")); ReviewDatas datas = ReviewDatasFile.load(new File("test/org/april/hebdobot/bot/stats/reviewstats.csv"));
datas.clean(); datas.clean();
logger.debug("File loaded."); logger.debug("File loaded.");
ReviewData currentReviewData = new ReviewData(LocalDateTime.now(), 12, 17L); ReviewData currentReviewData = new ReviewData(LocalDateTime.now(), 12, 17L);
@ -89,7 +67,7 @@ public class ReviewStatsTest
public void testReportNewUserCountRecord01() throws Exception public void testReportNewUserCountRecord01() throws Exception
{ {
System.out.println("================"); System.out.println("================");
ReviewDatas datas = ReviewDatasFile.load(new File("test/org/april/hebdobot/reviewstats/reviewstats.csv")); ReviewDatas datas = ReviewDatasFile.load(new File("test/org/april/hebdobot/bot/stats/reviewstats.csv"));
datas.clean(); datas.clean();
logger.debug("File loaded."); logger.debug("File loaded.");
ReviewData currentReview = new ReviewData(LocalDateTime.now(), 12, 17L); ReviewData currentReview = new ReviewData(LocalDateTime.now(), 12, 17L);
@ -109,7 +87,7 @@ public class ReviewStatsTest
public void testReportNewUserCountRecord02() throws Exception public void testReportNewUserCountRecord02() throws Exception
{ {
System.out.println("================"); System.out.println("================");
ReviewDatas datas = ReviewDatasFile.load(new File("test/org/april/hebdobot/reviewstats/reviewstats.csv")); ReviewDatas datas = ReviewDatasFile.load(new File("test/org/april/hebdobot/bot/stats/reviewstats.csv"));
datas.clean(); datas.clean();
logger.debug("File loaded."); logger.debug("File loaded.");
ReviewData currentReview = new ReviewData(LocalDateTime.now(), 42000, 17L); ReviewData currentReview = new ReviewData(LocalDateTime.now(), 42000, 17L);
@ -129,7 +107,7 @@ public class ReviewStatsTest
public void testReportUserCount() throws Exception public void testReportUserCount() throws Exception
{ {
System.out.println("================"); System.out.println("================");
ReviewDatas datas = ReviewDatasFile.load(new File("test/org/april/hebdobot/reviewstats/reviewstats.csv")); ReviewDatas datas = ReviewDatasFile.load(new File("test/org/april/hebdobot/bot/stats/reviewstats.csv"));
datas.clean(); datas.clean();
logger.debug("File loaded."); logger.debug("File loaded.");
ReviewData currentReview = new ReviewData(LocalDateTime.now(), 12, 17L); ReviewData currentReview = new ReviewData(LocalDateTime.now(), 12, 17L);