Commit 80f652f3 authored by Liang Ding's avatar Liang Ding

🔥 删除冗余代码

parent 2892550f
......@@ -29,7 +29,7 @@ import org.testng.annotations.Test;
* {@link OptionRepository} test case.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Apr 19, 2013
* @version 1.0.0.1, Jan 29, 2019
* @since 0.6.0
*/
@Test(suiteName = "repository")
......@@ -45,8 +45,8 @@ public final class OptionRepositoryImplTestCase extends AbstractTestCase {
final OptionRepository optionRepository = getOptionRepository();
final JSONObject option = new JSONObject();
option.put(Keys.OBJECT_ID, Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_BROADCAST);
option.put(Keys.OBJECT_ID, Option.ID_C_BLOG_TITLE);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
option.put(Option.OPTION_VALUE, 0L);
Transaction transaction = optionRepository.beginTransaction();
......@@ -54,6 +54,6 @@ public final class OptionRepositoryImplTestCase extends AbstractTestCase {
transaction.commit();
Assert.assertEquals(optionRepository.count(), 1);
Assert.assertNotNull(optionRepository.get(Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME));
Assert.assertNotNull(optionRepository.get(Option.ID_C_BLOG_TITLE));
}
}
......@@ -28,7 +28,7 @@ import org.testng.annotations.Test;
* {@link OptionMgmtService} test case.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Apr 19, 2013
* @version 1.0.0.1, Jan 29, 2019
* @since 0.6.0
*/
@Test(suiteName = "service")
......@@ -44,15 +44,15 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
final OptionMgmtService optionMgmtService = getOptionMgmtService();
final JSONObject option = new JSONObject();
option.put(Keys.OBJECT_ID, Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_BROADCAST);
option.put(Keys.OBJECT_ID, Option.ID_C_BLOG_TITLE);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
option.put(Option.OPTION_VALUE, 0L);
final String id = optionMgmtService.addOrUpdateOption(option);
//System.out.println(id);
Assert.assertNotNull(id);
final JSONObject opt = getOptionQueryService().getOptionById(Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME);
final JSONObject opt = getOptionQueryService().getOptionById(Option.ID_C_BLOG_TITLE);
Assert.assertEquals(opt.getInt(Option.OPTION_VALUE), 0L);
}
......@@ -66,8 +66,8 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
final OptionMgmtService optionMgmtService = getOptionMgmtService();
JSONObject option = new JSONObject();
option.put(Keys.OBJECT_ID, Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_BROADCAST);
option.put(Keys.OBJECT_ID, Option.ID_C_BLOG_TITLE);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
option.put(Option.OPTION_VALUE, 0L);
final String id = optionMgmtService.addOrUpdateOption(option); // Add
......@@ -75,13 +75,13 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
Assert.assertNotNull(id);
option = new JSONObject();
option.put(Keys.OBJECT_ID, Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_BROADCAST);
option.put(Keys.OBJECT_ID, Option.ID_C_BLOG_TITLE);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
option.put(Option.OPTION_VALUE, 1L);
optionMgmtService.addOrUpdateOption(option); // Update
final JSONObject opt = getOptionQueryService().getOptionById(Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME);
final JSONObject opt = getOptionQueryService().getOptionById(Option.ID_C_BLOG_TITLE);
Assert.assertEquals(opt.getInt(Option.OPTION_VALUE), 1L);
}
......@@ -95,8 +95,8 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
final OptionMgmtService optionMgmtService = getOptionMgmtService();
final JSONObject option = new JSONObject();
option.put(Keys.OBJECT_ID, Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_BROADCAST);
option.put(Keys.OBJECT_ID, Option.ID_C_BLOG_TITLE);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
option.put(Option.OPTION_VALUE, 0L);
final String id = optionMgmtService.addOrUpdateOption(option);
......
......@@ -28,7 +28,7 @@ import org.testng.annotations.Test;
* {@link OptionQueryService} test case.
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.1, Jul 16, 2017
* @version 1.0.0.2, Jan 29, 2019
* @since 0.6.0
*/
@Test(suiteName = "service")
......@@ -44,15 +44,15 @@ public class OptionQueryServiceTestCase extends AbstractTestCase {
// Check
final OptionQueryService optionQueryService = getOptionQueryService();
JSONObject options = optionQueryService.getOptions(Option.CATEGORY_C_BROADCAST);
JSONObject options = optionQueryService.getOptions(Option.CATEGORY_C_PREFERENCE);
Assert.assertNull(options);
// Add one
final OptionMgmtService optionMgmtService = getOptionMgmtService();
JSONObject option = new JSONObject();
option.put(Keys.OBJECT_ID, Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_BROADCAST);
option.put(Keys.OBJECT_ID, Option.ID_C_BLOG_TITLE);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
option.put(Option.OPTION_VALUE, 5L);
final String id = optionMgmtService.addOrUpdateOption(option);
......@@ -60,11 +60,11 @@ public class OptionQueryServiceTestCase extends AbstractTestCase {
// Check again
option = optionQueryService.getOptionById(Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME);
option = optionQueryService.getOptionById(Option.ID_C_BLOG_TITLE);
Assert.assertNotNull(option);
options = optionQueryService.getOptions(Option.CATEGORY_C_BROADCAST);
options = optionQueryService.getOptions(Option.CATEGORY_C_PREFERENCE);
Assert.assertNotNull(options);
Assert.assertEquals(options.optLong(Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME), 5L);
Assert.assertEquals(options.optLong(Option.ID_C_BLOG_TITLE), 5L);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment