### Question:
RulesRep extends DefaultRepBase { public List<PersistentRule> getGlobalRules() { List<PersistentRule> rules = new ArrayList<PersistentRule>(); FitPolicyRule globalFitPolicyRule = fitPolicyRuleDao.getGlobalFitPolicy(); List<EnterpriseExclusionRule> enterpriseExclusionRules = enterpriseExclusionRuleDao.findAll(); rules.add(globalFitPolicyRule); rules.addAll(enterpriseExclusionRules); return rules; } RulesRep();  RulesRep(final EntityManager entityManager); List<PersistentRule> getGlobalRules(); List<PersistentRule> getDatacenterRules(final Integer idDatacenter); List<EnterpriseExclusionRule> findAllEnterpriseExclusionRules(); EnterpriseExclusionRule findEnterpriseExclusionRuleById(final Integer id); void deleteEnterpriseExclusionRule(final EnterpriseExclusionRule enterpriseExclusionRule); EnterpriseExclusionRule insertEnterpriseExclusionRule(final EnterpriseExclusionRule rule); List<FitPolicyRule> findAllFitPolicyRules(); FitPolicyRule findFitPolicyRuleById(final Integer id); FitPolicyRule insertFitPolicyRule(final FitPolicyRule rule); List<MachineLoadRule> findAllMachineLoadRules(); MachineLoadRule findMachineLoadRuleById(final Integer id); List<MachineLoadRule> findMachineLoadRuleByMachine(final Integer id); List<MachineLoadRule> findMachineLoadRuleByRack(final Rack rack); List<MachineLoadRule> findMachineLoadRuleByRackIncludingMachines(final Rack rack); void deleteMachineLoadRule(final MachineLoadRule machineLoadRule); MachineLoadRule insertMachineLoadRule(final MachineLoadRule rule); Set<EnterpriseDto> findEnterprises(final EnterpriseExclusionRule eeR); void deleteFitPolicyRule(final FitPolicyRule fitPolicyRule); FitPolicyRule getFitPolicyForDatacenter(final Integer datacenterId); FitPolicyRule getGlobalFitPolicy(); List<MachineLoadRule> getMachineLoadForDatacenter(final Integer datacenterId);  }### Answer:
@Test public void test_getGlobalRules() { FitPolicyRule fpr = fitPolicyRuleGenerator.createUniqueInstance(); fpr.setDatacenter(null); EnterpriseExclusionRule eeRule1 = enterpriseExclusionRuleGenerator.createUniqueInstance(); EnterpriseExclusionRule eeRule2 = enterpriseExclusionRuleGenerator.createUniqueInstance(); List<Object> allToPersist = new ArrayList<Object>(); enterpriseExclusionRuleGenerator.addAuxiliaryEntitiesToPersist(eeRule1, allToPersist); enterpriseExclusionRuleGenerator.addAuxiliaryEntitiesToPersist(eeRule2, allToPersist); persistAll(ds(), allToPersist, eeRule1, eeRule2, fpr); EntityManager em = ds().createEntityManagerAndBeginReadWriteTransaction(); RulesRep rep = new RulesRep(em); List<PersistentRule> result = rep.getGlobalRules(); assertNotNull(result); assertEquals(result.size(), 3); }