Github user gerlowskija commented on a diff in the pull request:

    https://github.com/apache/lucene-solr/pull/464#discussion_r227030813
  
    --- 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 --
    
    [0] I'm still somewhat leery of changing how the version variables are used 
here.  I agree with what seems like your intent here - that `final` variables 
often make it much easier to reason about Java code.  But with how flaky the 
tests are, I'd rather not introduce such changes here.  


---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to