NoSQLUnit 0.6.0 Released!
NoSQLUnit is a JUnit extension to make writing unit and integration tests of systems that use NoSQL backend easier. Visit official page for more information.
- Embedded: com.lordofthejars.nosqlunit.hbase.EmbeddedHBase
- Managed: com.lordofthejars.nosqlunit.hbase.ManagedHBase
- NoSQLUnit Management: com.lordofthejars.nosqlunit.hbase.HBaseRule
{
"name" : "person",
"columnFamilies" : [{
"name" : "personFamilyName",
"rows" : [{
"key" : "john",
"columns" : [{
"name" : "age",
"value" : "22"
},
{
"name" : "car",
"value" : "toyota"
}]
},
{
"key" : "mary",
"columns" : [{
"name" : "age",
"value" : "33"
},
{
"name" : "car",
"value" : "ford"
}]
}]
}]
}
and finally the test case:public class WhenPersonWantsToKnowItsCar {
@ClassRule
public static EmbeddedHBase embeddedHBase = newEmbeddedHBaseRule().build();
@Rule
public HBaseRule hBaseRule = newHBaseRule().defaultEmbeddedHBase(this);
@Inject
private Configuration configuration;
@Test
@UsingDataSet(locations="persons.json", loadStrategy=LoadStrategyEnum.CLEAN_INSERT)
public void car_should_be_returned() throws IOException {
PersonManager personManager = new PersonManager(configuration);
String car = personManager.getCarByPersonName("john");
assertThat(car, is("toyota"));
}
}
Stay in touch with the project and of course I am opened to any ideas that you think that could make NoSQLUnit better.(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)





