Github user gerlowskija commented on a diff in the pull request:
https://github.com/apache/lucene-solr/pull/464#discussion_r227202749
--- Diff: solr/core/src/test/org/apache/solr/search/TestRealTimeGet.java ---
@@ -414,56 +391,44 @@ public void testOptimisticLocking() throws Exception {
version2 = addAndGetVersion(sdoc("id","1", "_version_",
Long.toString(version)), null);
assertTrue(version2 > version);
- try {
- // overwriting the previous version should now fail
- version2 = addAndGetVersion(sdoc("id","1"), params("_version_",
Long.toString(version)));
- fail();
- } catch (SolrException se) {
- assertEquals(409, se.code());
- }
+ // overwriting the previous version should now fail
+ se = expectThrows(SolrException.class, "overwriting previous version
should fail",
+ () -> addAndGetVersion(sdoc("id","1"), params("_version_",
Long.toString(version))));
+ assertEquals(409, se.code());
- try {
- // deleting the previous version should now fail
- version2 = deleteAndGetVersion("1", params("_version_",
Long.toString(version)));
- fail();
- } catch (SolrException se) {
- assertEquals(409, se.code());
- }
+ // deleting the previous version should now fail
+ se = expectThrows(SolrException.class, "deleting the previous version
should now fail",
+ () -> deleteAndGetVersion("1", params("_version_",
Long.toString(version))));
+ assertEquals(409, se.code());
- version = version2;
+ final long prevVersion = version2;
--- End diff --
Oof, yeah good point, that would be a problem. No need to revert. I'll
just need to pay particular attention to this class when testing things out.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]