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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor - P4 Minor - P4
    • 2.8.0
    • 2.7
    • API
    • None
    • Windows 7
    • Minor Change

    Description

      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));
      	}
      	

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: