Can't create Lombok class inside my test class: modifier static not allowed here

Sandro Rey
:

I want to create a Lombok class inside a test class

@RunWith(SpringRunner.class)
@SpringBootTest
public class HostelIntegrationTest  {


    @Data
    @Builder
    @NoArgsConstructor
    @AllArgsConstructor
    @JsonInclude(NON_NULL)
    @EqualsAndHashCode
    class User {
        String property1;
        Instant property2;
        Integer property3;
    }

but I get this compilation error:

modifier static not allowed here

dehasi
:

@Builder makes a static internal class inside. The problem is probably the static internal class inside the non-static internal class.

Try to make User also static

//other annotations
@Builder    
static class User {
    String property1;
    Instant property2;
    Integer property3;
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Can't call static method inside class

From Dev

Can't call a class inside of my activity

From Dev

Can't call a class inside of my activity

From Dev

Can't use lombok @NoArgsConstructor on a class

From Dev

Why can't I create a new Thread with an instance of my class?

From Dev

Static modifier requirement in class/page

From Dev

How can I create a static class in Swift?

From Dev

Why an Outer Class Can’t Be Static?

From Dev

Can I create a class inside other class? and call all together

From Dev

Can I create a class inside other class? and call all together

From Dev

Proper way to create static instance of a class inside of itself

From Dev

Why can't a class extend a static nested class occurring within it?

From Dev

Nested class AsyncTask can't modify Outer Class static objects

From Dev

Why won't my Test class pull the main class correctly?

From Dev

Why I can't pass class object by reference here?

From Dev

Why I can't pass class object by reference here?

From Dev

Can't access variable inside same class

From Dev

Lombok @SuperBuilder is not initializing my class objects

From Dev

Can you set a static enum inside of a TypeScript class?

From Dev

Can we define static class member inside constructor?

From Dev

Can't access class parameter values from function inside the class

From Dev

"this" is undefined inside my Class

From Dev

Why is a static local class not allowed in a method?

From Dev

Why is a static local class not allowed in a method?

From Dev

Error in derived TimerTask class: `Can't create handler inside thread that has not called Looper.prepare()`

From Dev

Error in derived TimerTask class: `Can't create handler inside thread that has not called Looper.prepare()`

From Java

Why can't I import AndroidJUnit4 and ActivityTestRule into my unit test class?

From Dev

Can't run my test from only one class using testNG, maven, NetBeans

From Dev

Static nested class inside parameterized class

Related Related

  1. 1

    Can't call static method inside class

  2. 2

    Can't call a class inside of my activity

  3. 3

    Can't call a class inside of my activity

  4. 4

    Can't use lombok @NoArgsConstructor on a class

  5. 5

    Why can't I create a new Thread with an instance of my class?

  6. 6

    Static modifier requirement in class/page

  7. 7

    How can I create a static class in Swift?

  8. 8

    Why an Outer Class Can’t Be Static?

  9. 9

    Can I create a class inside other class? and call all together

  10. 10

    Can I create a class inside other class? and call all together

  11. 11

    Proper way to create static instance of a class inside of itself

  12. 12

    Why can't a class extend a static nested class occurring within it?

  13. 13

    Nested class AsyncTask can't modify Outer Class static objects

  14. 14

    Why won't my Test class pull the main class correctly?

  15. 15

    Why I can't pass class object by reference here?

  16. 16

    Why I can't pass class object by reference here?

  17. 17

    Can't access variable inside same class

  18. 18

    Lombok @SuperBuilder is not initializing my class objects

  19. 19

    Can you set a static enum inside of a TypeScript class?

  20. 20

    Can we define static class member inside constructor?

  21. 21

    Can't access class parameter values from function inside the class

  22. 22

    "this" is undefined inside my Class

  23. 23

    Why is a static local class not allowed in a method?

  24. 24

    Why is a static local class not allowed in a method?

  25. 25

    Error in derived TimerTask class: `Can't create handler inside thread that has not called Looper.prepare()`

  26. 26

    Error in derived TimerTask class: `Can't create handler inside thread that has not called Looper.prepare()`

  27. 27

    Why can't I import AndroidJUnit4 and ActivityTestRule into my unit test class?

  28. 28

    Can't run my test from only one class using testNG, maven, NetBeans

  29. 29

    Static nested class inside parameterized class

HotTag

Archive