Skip to content
Snippets Groups Projects
Commit 5c62ab7c authored by srosse's avatar srosse
Browse files

OO-3988: add some unit tests

parent b13fc46b
No related branches found
No related tags found
No related merge requests found
......@@ -48,6 +48,10 @@ public class ReminderRulesXStream {
return (ReminderRules)ruleXStream.fromXML(rulesXml);
}
public static ReminderRules toRules(InputStream in) {
return (ReminderRules)ruleXStream.fromXML(in);
}
public static String toXML(ReminderRules rules) {
return ruleXStream.toXML(rules);
}
......
/**
* <a href="http://www.openolat.org">
* OpenOLAT - Online Learning and Training</a><br>
* <p>
* Licensed under the Apache License, Version 2.0 (the "License"); <br>
* you may not use this file except in compliance with the License.<br>
* You may obtain a copy of the License at the
* <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a>
* <p>
* Unless required by applicable law or agreed to in writing,<br>
* software distributed under the License is distributed on an "AS IS" BASIS, <br>
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br>
* See the License for the specific language governing permissions and <br>
* limitations under the License.
* <p>
* Initial code contributed and copyrighted by<br>
* frentix GmbH, http://www.frentix.com
* <p>
*/
package org.olat.modules.reminder.manager;
import java.io.IOException;
import java.io.InputStream;
import org.junit.Assert;
import org.junit.Test;
import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing;
import org.olat.modules.reminder.model.ReminderRules;
/**
*
* Initial date: 26 mars 2019<br>
* @author srosse, stephane.rosse@frentix.com, http://www.frentix.com
*
*/
public class ReminderRulesXStreamTest {
private static final OLog log = Tracing.createLoggerFor(ReminderRulesXStreamTest.class);
@Test
public void readXml() {
ReminderRules reminderRules = null;
try(InputStream input=ReminderRulesXStreamTest.class.getResourceAsStream("reminder_rules_1.xml")) {
reminderRules = ReminderRulesXStream.toRules(input);
} catch(IOException e) {
log.error("", e);
}
Assert.assertNotNull(reminderRules);
Assert.assertNotNull(reminderRules.getRules());
Assert.assertEquals(3, reminderRules.getRules().size());
}
}
<rules>
<rules>
<rule>
<type>DateRuleSPI</type>
<operator>&gt;</operator>
<rightOperand>2015-05-13T00:00:00</rightOperand>
</rule>
<rule>
<type>BusinessGroupRoleRuleSPI</type>
<operator>=</operator>
<rightOperand>128286721</rightOperand>
</rule>
<rule>
<type>PassedRuleSPI</type>
<leftOperand>91610795686842</leftOperand>
<operator>=</operator>
<rightOperand>passed</rightOperand>
</rule>
</rules>
</rules>
\ No newline at end of file
......@@ -210,6 +210,7 @@ import org.junit.runners.Suite;
org.olat.modules.reminder.ReminderModuleTest.class,
org.olat.modules.reminder.manager.ReminderDAOTest.class,
org.olat.modules.reminder.manager.ReminderRuleEngineTest.class,
org.olat.modules.reminder.manager.ReminderRulesXStreamTest.class,
org.olat.modules.taxonomy.manager.TaxonomyDAOTest.class,
org.olat.modules.taxonomy.manager.TaxonomyLevelDAOTest.class,
org.olat.modules.taxonomy.manager.TaxonomyLevelTypeDAOTest.class,
......@@ -329,6 +330,7 @@ import org.junit.runners.Suite;
org.olat.restapi.NotificationsSubscribersTest.class,
org.olat.restapi.RepositoryEntryLifecycleTest.class,
org.olat.restapi.RepositoryEntriesTest.class,
org.olat.restapi.RemindersWebServiceTest.class,
org.olat.restapi.RepositoryEntryResourceTest.class,
org.olat.restapi.RestApiLoginFilterTest.class,
org.olat.restapi.UserAuthenticationMgmtTest.class,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment