You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Igor Demydenko (JIRA)" <ji...@apache.org> on 2010/11/24 16:49:13 UTC

[jira] Updated: (CASSANDRA-1775) SlicePredicate doesn't support the java.lang.Object.equals() method contract

     [ https://issues.apache.org/jira/browse/CASSANDRA-1775?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Demydenko updated CASSANDRA-1775:
--------------------------------------

    Description: 
SlicePredicate doesn't support the java.lang.Object.equals() method contract.

Execute following test:
{code:title=SlicePredicateTest.java}
public class SlicePredicateTest {
    private static final String ENCODING = "UTF-8";
    private static final String COLUMN_NAME = "ColumnName";

    @Test
    public void testEquals() throws Exception {

        SlicePredicate predicate = new SlicePredicate();
        predicate.setColumn_names(Arrays.asList(COLUMN_NAME.getBytes(ENCODING)));

        SlicePredicate predicate2 = new SlicePredicate();
        predicate2.setColumn_names(Arrays.asList(COLUMN_NAME.getBytes(ENCODING)));

        SlicePredicate predicate3 = new SlicePredicate();
        predicate3.setColumn_names(Arrays.asList(COLUMN_NAME.getBytes(ENCODING)));

        assertFalse(predicate.equals(null)); // not null
        assertTrue(predicate.equals(predicate)); // reflexivity
        assertTrue(predicate.equals(predicate2) && predicate2.equals(predicate)); // symmetry
        assertTrue(predicate.equals(predicate2) && predicate2.equals(predicate3) 
                && predicate.equals(predicate3)); // transitivity
    }
}
{code}

  was:
SlicePredicate doesn't support the java.lang.Object.equals() method contract.

Execute following test:

public class SlicePredicateTest {
    private static final String ENCODING = "UTF-8";
    private static final String COLUMN_NAME = "ColumnName";

    @Test
    public void testEquals() throws Exception {

        SlicePredicate predicate = new SlicePredicate();
        predicate.setColumn_names(Arrays.asList(COLUMN_NAME.getBytes(ENCODING)));

        SlicePredicate predicate2 = new SlicePredicate();
        predicate2.setColumn_names(Arrays.asList(COLUMN_NAME.getBytes(ENCODING)));

        SlicePredicate predicate3 = new SlicePredicate();
        predicate3.setColumn_names(Arrays.asList(COLUMN_NAME.getBytes(ENCODING)));

        assertFalse(predicate.equals(null)); // not null
        assertTrue(predicate.equals(predicate)); // reflexivity
        assertTrue(predicate.equals(predicate2) && predicate2.equals(predicate)); // symmetry
        assertTrue(predicate.equals(predicate2) && predicate2.equals(predicate3) 
                && predicate.equals(predicate3)); // transitivity
    }
}



> SlicePredicate doesn't support the java.lang.Object.equals() method contract
> ----------------------------------------------------------------------------
>
>                 Key: CASSANDRA-1775
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-1775
>             Project: Cassandra
>          Issue Type: Bug
>          Components: API
>    Affects Versions: 0.6.6
>         Environment: apcahe cassandra 0.6.6
> lib thrift r917130
>            Reporter: Igor Demydenko
>            Priority: Minor
>
> SlicePredicate doesn't support the java.lang.Object.equals() method contract.
> Execute following test:
> {code:title=SlicePredicateTest.java}
> public class SlicePredicateTest {
>     private static final String ENCODING = "UTF-8";
>     private static final String COLUMN_NAME = "ColumnName";
>     @Test
>     public void testEquals() throws Exception {
>         SlicePredicate predicate = new SlicePredicate();
>         predicate.setColumn_names(Arrays.asList(COLUMN_NAME.getBytes(ENCODING)));
>         SlicePredicate predicate2 = new SlicePredicate();
>         predicate2.setColumn_names(Arrays.asList(COLUMN_NAME.getBytes(ENCODING)));
>         SlicePredicate predicate3 = new SlicePredicate();
>         predicate3.setColumn_names(Arrays.asList(COLUMN_NAME.getBytes(ENCODING)));
>         assertFalse(predicate.equals(null)); // not null
>         assertTrue(predicate.equals(predicate)); // reflexivity
>         assertTrue(predicate.equals(predicate2) && predicate2.equals(predicate)); // symmetry
>         assertTrue(predicate.equals(predicate2) && predicate2.equals(predicate3) 
>                 && predicate.equals(predicate3)); // transitivity
>     }
> }
> {code}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.