sms.setUserConnection(null);
sms.startBatch();
when(sms.update("updateFoo", new Foo("bar"))).thenReturn(1);
List<BatchResult> results = Collections.singletonList(new BatchResult("updateFoo", "update foo"));
results.get(0).setUpdateCounts(new int[] {0});
when(sms.executeBatchDetailed()).thenReturn(results);
try {
writer.write(Collections.singletonList(new Foo("bar")));
fail("Expected EmptyResultDataAccessException");
}
catch (EmptyResultDataAccessException e) {