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

🔥 删除冗余代码

parent 2892550f
...@@ -29,7 +29,7 @@ import org.testng.annotations.Test; ...@@ -29,7 +29,7 @@ import org.testng.annotations.Test;
* {@link OptionRepository} test case. * {@link OptionRepository} test case.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @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 * @since 0.6.0
*/ */
@Test(suiteName = "repository") @Test(suiteName = "repository")
...@@ -45,8 +45,8 @@ public final class OptionRepositoryImplTestCase extends AbstractTestCase { ...@@ -45,8 +45,8 @@ public final class OptionRepositoryImplTestCase extends AbstractTestCase {
final OptionRepository optionRepository = getOptionRepository(); final OptionRepository optionRepository = getOptionRepository();
final JSONObject option = new JSONObject(); final JSONObject option = new JSONObject();
option.put(Keys.OBJECT_ID, Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME); option.put(Keys.OBJECT_ID, Option.ID_C_BLOG_TITLE);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_BROADCAST); option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
option.put(Option.OPTION_VALUE, 0L); option.put(Option.OPTION_VALUE, 0L);
Transaction transaction = optionRepository.beginTransaction(); Transaction transaction = optionRepository.beginTransaction();
...@@ -54,6 +54,6 @@ public final class OptionRepositoryImplTestCase extends AbstractTestCase { ...@@ -54,6 +54,6 @@ public final class OptionRepositoryImplTestCase extends AbstractTestCase {
transaction.commit(); transaction.commit();
Assert.assertEquals(optionRepository.count(), 1); 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; ...@@ -28,7 +28,7 @@ import org.testng.annotations.Test;
* {@link OptionMgmtService} test case. * {@link OptionMgmtService} test case.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @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 * @since 0.6.0
*/ */
@Test(suiteName = "service") @Test(suiteName = "service")
...@@ -44,15 +44,15 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase { ...@@ -44,15 +44,15 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
final OptionMgmtService optionMgmtService = getOptionMgmtService(); final OptionMgmtService optionMgmtService = getOptionMgmtService();
final JSONObject option = new JSONObject(); final JSONObject option = new JSONObject();
option.put(Keys.OBJECT_ID, Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME); option.put(Keys.OBJECT_ID, Option.ID_C_BLOG_TITLE);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_BROADCAST); option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
option.put(Option.OPTION_VALUE, 0L); option.put(Option.OPTION_VALUE, 0L);
final String id = optionMgmtService.addOrUpdateOption(option); final String id = optionMgmtService.addOrUpdateOption(option);
//System.out.println(id); //System.out.println(id);
Assert.assertNotNull(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); Assert.assertEquals(opt.getInt(Option.OPTION_VALUE), 0L);
} }
...@@ -66,8 +66,8 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase { ...@@ -66,8 +66,8 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
final OptionMgmtService optionMgmtService = getOptionMgmtService(); final OptionMgmtService optionMgmtService = getOptionMgmtService();
JSONObject option = new JSONObject(); JSONObject option = new JSONObject();
option.put(Keys.OBJECT_ID, Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME); option.put(Keys.OBJECT_ID, Option.ID_C_BLOG_TITLE);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_BROADCAST); option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
option.put(Option.OPTION_VALUE, 0L); option.put(Option.OPTION_VALUE, 0L);
final String id = optionMgmtService.addOrUpdateOption(option); // Add final String id = optionMgmtService.addOrUpdateOption(option); // Add
...@@ -75,13 +75,13 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase { ...@@ -75,13 +75,13 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
Assert.assertNotNull(id); Assert.assertNotNull(id);
option = new JSONObject(); option = new JSONObject();
option.put(Keys.OBJECT_ID, Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME); option.put(Keys.OBJECT_ID, Option.ID_C_BLOG_TITLE);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_BROADCAST); option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
option.put(Option.OPTION_VALUE, 1L); option.put(Option.OPTION_VALUE, 1L);
optionMgmtService.addOrUpdateOption(option); // Update 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); Assert.assertEquals(opt.getInt(Option.OPTION_VALUE), 1L);
} }
...@@ -95,8 +95,8 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase { ...@@ -95,8 +95,8 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
final OptionMgmtService optionMgmtService = getOptionMgmtService(); final OptionMgmtService optionMgmtService = getOptionMgmtService();
final JSONObject option = new JSONObject(); final JSONObject option = new JSONObject();
option.put(Keys.OBJECT_ID, Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME); option.put(Keys.OBJECT_ID, Option.ID_C_BLOG_TITLE);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_BROADCAST); option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
option.put(Option.OPTION_VALUE, 0L); option.put(Option.OPTION_VALUE, 0L);
final String id = optionMgmtService.addOrUpdateOption(option); final String id = optionMgmtService.addOrUpdateOption(option);
......
...@@ -28,7 +28,7 @@ import org.testng.annotations.Test; ...@@ -28,7 +28,7 @@ import org.testng.annotations.Test;
* {@link OptionQueryService} test case. * {@link OptionQueryService} test case.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @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 * @since 0.6.0
*/ */
@Test(suiteName = "service") @Test(suiteName = "service")
...@@ -44,15 +44,15 @@ public class OptionQueryServiceTestCase extends AbstractTestCase { ...@@ -44,15 +44,15 @@ public class OptionQueryServiceTestCase extends AbstractTestCase {
// Check // Check
final OptionQueryService optionQueryService = getOptionQueryService(); final OptionQueryService optionQueryService = getOptionQueryService();
JSONObject options = optionQueryService.getOptions(Option.CATEGORY_C_BROADCAST); JSONObject options = optionQueryService.getOptions(Option.CATEGORY_C_PREFERENCE);
Assert.assertNull(options); Assert.assertNull(options);
// Add one // Add one
final OptionMgmtService optionMgmtService = getOptionMgmtService(); final OptionMgmtService optionMgmtService = getOptionMgmtService();
JSONObject option = new JSONObject(); JSONObject option = new JSONObject();
option.put(Keys.OBJECT_ID, Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME); option.put(Keys.OBJECT_ID, Option.ID_C_BLOG_TITLE);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_BROADCAST); option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
option.put(Option.OPTION_VALUE, 5L); option.put(Option.OPTION_VALUE, 5L);
final String id = optionMgmtService.addOrUpdateOption(option); final String id = optionMgmtService.addOrUpdateOption(option);
...@@ -60,11 +60,11 @@ public class OptionQueryServiceTestCase extends AbstractTestCase { ...@@ -60,11 +60,11 @@ public class OptionQueryServiceTestCase extends AbstractTestCase {
// Check again // Check again
option = optionQueryService.getOptionById(Option.ID_C_BROADCAST_CHANCE_EXPIRATION_TIME); option = optionQueryService.getOptionById(Option.ID_C_BLOG_TITLE);
Assert.assertNotNull(option); Assert.assertNotNull(option);
options = optionQueryService.getOptions(Option.CATEGORY_C_BROADCAST); options = optionQueryService.getOptions(Option.CATEGORY_C_PREFERENCE);
Assert.assertNotNull(options); 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