RulesManager { protected Rules getRule(EntityManager em, short ruleId) { try { Rules resultResult = em.createNamedQuery(Queries.RULES_FIND_BY_ID, Rules.class) .setParameter(PARAM_RULE_ID, ruleId).getSingleResult(); return resultResult; } catch (Exception e) { throw new NoResultException("Rule:" + ruleId + " not found"); } } private  RulesManager(); static RulesManager getInstance(); short createNewRule(EntityManager em, Rules dbRule, Tenant tenant); Rule saveRule(EntityManager em, Rules dbRule, Tenant tenant, Rule currRule, ApplicationManager am); void sendRuleToKafka(boolean delete, String tenantId, Rule rule, ApplicationManager am); void sendRuleToKafka(boolean delete, String tenantId, String ruleJson, ApplicationManager am); Rules getRule(EntityManager em, String tenantId, short ruleId); List<Short> getRuleByTemplateId(EntityManager em, String tenantId, short templateId); void deleteRule(EntityManager em, String tenantId, short ruleId, ApplicationManager am); void deleteRules(EntityManager em, Tenant tenant, ApplicationManager am); void disableAllRules(EntityManager em, String tenantId, ApplicationManager am); List<Rule> getRuleObjects(EntityManager em, String tenantId); List<Rules> getRules(EntityManager em, String tenantId); String getRuleContents(EntityManager em, String tenantId, boolean pretty, int filter); Rules enableDisableRule(EntityManager em, boolean ruleState, String tenantId, short ruleId,
			ApplicationManager am); Tenant getTenant(EntityManager em, String tenantId);  }
@Test public void testGetRule() throws Exception { Tenant tenant = RulesManager.getInstance().getTenant(em, TENANT_ID_3); Rules rule = new Rules(); short ruleId = RulesManager.getInstance().createNewRule(em, rule, tenant); Rules rule2 = RulesManager.getInstance().getRule(em, ruleId); assertEquals(ruleId, rule2.getRuleId()); }