Hi all, I am currently developing an openmrs module. But the only issue i currently have is when running my test. I receive this error: org.dbunit.dataset.NoSuchTableException: managepricing_drugpricing
This is a snapshot of my current project structure:
These are some of the relevant source code:
TestingApplicationContext.xml:
<bean id="sessionFactory" class="org.openmrs.api.db.hibernate.HibernateSessionFactoryBean">
<property name="configLocations">
<list>
<value>classpath:hibernate.cfg.xml</value>
<value>classpath:managepricing-hibernate.cfg.xml</value>
</list>
</property>
<property name="mappingJarLocations">
<ref bean="mappingJarResources" />
</property>
<!-- default properties must be set in the hibernate.default.properties -->
</bean>
Thanks. This works okay. But I now have another error:
getDrugPricingByType_shouldReturnListOfDrugpricingForAType(org.openmrs.module.mangepricing.api.DrugPricingServiceTest) Time elapsed: 0.38 sec <<< ERROR!
java.lang.NullPointerException
at org.dbunit.dataset.datatype.IntegerDataType.setSqlValue(IntegerDataType.java:106)
at org.dbunit.database.statement.SimplePreparedStatement.addValue(SimplePreparedStatement.java:73)
at org.dbunit.operation.RefreshOperation$RowOperation.execute(RefreshOperation.java:180)
at org.dbunit.operation.RefreshOperation.execute(RefreshOperation.java:110)
at org.openmrs.test.BaseContextSensitiveTest.executeDataSet(BaseContextSensitiveTest.java:572)
at org.openmrs.test.BaseContextSensitiveTest.executeDataSet(BaseContextSensitiveTest.java:484)
at org.openmrs.module.mangepricing.api.DrugPricingServiceTest.getDrugPricingByType_shouldReturnListOfDrugpricingForAType(DrugPricingServiceTest.java:45)
This is the function where the error emanates from:
public void getDrugPricingByType_shouldReturnListOfDrugpricingForAType() throws Exception {
initializeInMemoryDatabase();
executeDataSet("testDataSet.xml");
authenticate();
DrugPricingService drugPricingService = Context.getService(DrugPricingService.class);
System.out.println("\n GET HMO BY TYPE");
List<DrugPricing> facilityTypeList = drugPricingService.getDrugPricingByType("Facility", false);
Assert.assertTrue(facilityTypeList.size() >= 1); // assert that it returns more than a single list
}//getDrugPricingByType