Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-472

WriteConcern equals uses == instead of equals() for _w object and no hashcode() impl

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.8.0
    • Affects Version/s: 2.7
    • Component/s: API
    • None
    • Environment:
      Windows 7
    • Minor Change

      This test will fail since WriteConcern's equals methods uses == and not equals() for the _w field. I noticed this when testing the new API to pass a string into the WriteConcern constructor. Here is a failing test case

      	public void testWriteConcernEquality() {
      		String s1 =  new String("rack1");
      		String s2 =  new String("rack1");
      		WriteConcern wc1 = new WriteConcern(s1);
      		WriteConcern wc2 = new WriteConcern(s2);
      		assertThat(wc1, equalTo(wc2));
      	}
      	
      

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            markpollack Mark Pollack
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: