Commit c871cb1d authored by Liang Ding's avatar Liang Ding

获取 prefs

parent f21b216d
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
*/ */
package org.b3log.solo.service; package org.b3log.solo.service;
import org.b3log.latke.Keys;
import org.b3log.solo.AbstractTestCase; import org.b3log.solo.AbstractTestCase;
import org.b3log.solo.model.Option; import org.b3log.solo.model.Option;
import org.json.JSONObject; import org.json.JSONObject;
...@@ -35,37 +34,13 @@ import org.testng.annotations.Test; ...@@ -35,37 +34,13 @@ import org.testng.annotations.Test;
public class OptionQueryServiceTestCase extends AbstractTestCase { public class OptionQueryServiceTestCase extends AbstractTestCase {
/** /**
* Gets. * Init.
* *
* @throws Exception exception * @throws Exception exception
*/ */
@Test @Test
public void get() throws Exception { public void init() throws Exception {
// Check super.init();
final OptionQueryService optionQueryService = getOptionQueryService();
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_BLOG_TITLE);
option.put(Option.OPTION_CATEGORY, Option.CATEGORY_C_PREFERENCE);
option.put(Option.OPTION_VALUE, 5L);
final String id = optionMgmtService.addOrUpdateOption(option);
Assert.assertNotNull(id);
// Check again
option = optionQueryService.getOptionById(Option.ID_C_BLOG_TITLE);
Assert.assertNotNull(option);
options = optionQueryService.getOptions(Option.CATEGORY_C_PREFERENCE);
Assert.assertNotNull(options);
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