Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid getter/setter if using @Accessors(chain = true) #142

Open
in3des opened this issue Oct 13, 2022 · 2 comments
Open

Invalid getter/setter if using @Accessors(chain = true) #142

in3des opened this issue Oct 13, 2022 · 2 comments

Comments

@in3des
Copy link

in3des commented Oct 13, 2022

Hi,
It comes out there is an issue if you are using Lombok annotation @Accessors(chain = true).
Tests couldn't pass and give the following error:
bean with valid setter and getter methods for all properties bean of type "..." had an invalid getter/setter for the property "..."

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class KeyValue {
    private String key;
    private String value;
}

If remove it - then everything works just fine.
But I hope there is possibility to add some extra options or settings, so it could also work with this annotation.

Thanks!

simple test itself

import static com.google.code.beanmatchers.BeanMatchers.*;
import static org.hamcrest.CoreMatchers.allOf;
import static org.hamcrest.MatcherAssert.assertThat;

class KVTest {

    @Test
    void testBean() {
        assertThat(KeyValue.class, allOf(
                hasValidBeanConstructor(),
                hasValidGettersAndSetters(),
                hasValidBeanHashCode(),
                hasValidBeanEquals(),
                hasValidBeanToString()
        ));
    }
}

PS.
only one assertion works so far... ((

    @Test
    void testBean() {
        assertThat(KeyValue.class, allOf(
                hasValidBeanConstructor()
//                hasValidGettersAndSetters(),
//                hasValidBeanHashCode(),
//                hasValidBeanEquals(),
//                hasValidBeanToString()
        ));
    }

these three hasValidBeanHashCode(), hasValidBeanEquals(), hasValidBeanToString()
produce com.google.code.beanmatchers.AccessorMissingException: missing setter for the property key

@AleksanderShkuratov
Copy link

This really needs to be done as soon as possible

@lvv-easy
Copy link

Please release this feature asap!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants