AssertJ and Groovy not playing nicely togetherGroovy executing shell commandsGroovy: what's the purpose of “def” in “def x = 0”?How do I get Groovy and JAXB to play nice togetherScala vs. Groovy vs. ClojureGroovy String to intGetting groovy, maven, and eclipse to play nice together?How to read a file in Groovy into a string?Groovy 2.x and Mockito not playing nicely togetherGuice, Groovy, @Canonical and inheritance not playing nicely togetherAssertJ and Groovy force type?

How to win an all out war against ants

Representation of the concatenation at the type level

Generate random number in Unity without class ambiguity

In MTG, was there ever a five-color deck that worked well?

Does a bard know when a character uses their Bardic Inspiration?

Is Norway in the Single Market?

Is there a way to say "double + any number" in German?

A wiild aanimal, a cardinal direction, or a place by the water

Gödel's paradox: Why is "a proof that some universal statement is unprovable" not a valid proof that this statement is true?

What license to choose for my PhD thesis?

Has J.J.Jameson ever found out that Peter Parker is Spider-Man?

Speaker impedance: rewiring four 8 Ω speakers for use with 8 Ω amp output

Astable 555 circuit not oscillating

What printing process is this?

Have you been refused entry into the Federal Republic of Germany?

How to call made-up data?

How do I safety check that there is no light in Darkroom / Darkbag?

Is the first page of Novel really that important?

On the expression "sun-down"

Can you shove a friendly creature?

When using the Proficiency Dice optional rule, how should they be used in determining a character's Spell Save DC?

What is Albrecht Dürer's Perspective Machine drawing style?

Any information about the photo with Army Uniforms

Why adjustbox needs a tweak of raise=-0.3ex with enumitem?



AssertJ and Groovy not playing nicely together


Groovy executing shell commandsGroovy: what's the purpose of “def” in “def x = 0”?How do I get Groovy and JAXB to play nice togetherScala vs. Groovy vs. ClojureGroovy String to intGetting groovy, maven, and eclipse to play nice together?How to read a file in Groovy into a string?Groovy 2.x and Mockito not playing nicely togetherGuice, Groovy, @Canonical and inheritance not playing nicely togetherAssertJ and Groovy force type?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm encountering a weird issue / bug with assert j and groovy with step verifier testing mongo db. I've included some code to help you reproduce this locally and also I have made the test work by replacing the closure with just a string.



I have the following code:



 @Document
@ToString(includePackage = false, includeFields = true)
class Image
@Id private String id
private String name

Image()


Image(String id, String name)
this.id = id
this.name = name


String getId()
return id


void setId(String id)
this.id = id


String getName()
return name


void setName(String name)
this.name = name




ImageRepository.groovy



interface ImageRepository extends ReactiveCrudRepository<Image, String>
Mono<Image> findByName(String name)



and the following test



@RunWith(SpringRunner)
@DataMongoTest
class EmbeddedImageRepositoryTests

@Autowired
ImageRepository repository

@Autowired
MongoOperations operations

@Before
void setup()
operations.dropCollection(Image)
operations.insert(new Image([
id : '1',
name: 'learning-spring-boot-cover.jpg'
]))
operations.insert(new Image([
id : '2',
name: 'learning-spring-boot-2nd-edition.jpg'
]))
operations.insert(new Image([
id : '3',
name: 'bazinga.png'
]))
operations.findAll(Image).each println it


@Test
void findAllShouldWork()
Flux<Image> images = repository.findAll()
StepVerifier.create(images)
.recordWith( new ArrayList<>() )
.expectNextCount(3)
.consumeRecordedWith(

assertThat(it).hasSize(3)
assertThat(it)
.extracting(it.name)
.contains(
'learning-spring-boot-cover.jpg',
'learning-spring-boot-2nd-edition.jpg',
'bazinga.png')
)
.expectComplete()
.verify()




The test fails and the offending line is this after some



.extracting(it.name)


When it is changed to



.extracting('name')


Then the test passes. Has anybody had the same problem with using assert J and groovy and step verifier?










share|improve this question
























  • what exception do you have?

    – daggett
    Mar 27 at 10:53

















0















I'm encountering a weird issue / bug with assert j and groovy with step verifier testing mongo db. I've included some code to help you reproduce this locally and also I have made the test work by replacing the closure with just a string.



I have the following code:



 @Document
@ToString(includePackage = false, includeFields = true)
class Image
@Id private String id
private String name

Image()


Image(String id, String name)
this.id = id
this.name = name


String getId()
return id


void setId(String id)
this.id = id


String getName()
return name


void setName(String name)
this.name = name




ImageRepository.groovy



interface ImageRepository extends ReactiveCrudRepository<Image, String>
Mono<Image> findByName(String name)



and the following test



@RunWith(SpringRunner)
@DataMongoTest
class EmbeddedImageRepositoryTests

@Autowired
ImageRepository repository

@Autowired
MongoOperations operations

@Before
void setup()
operations.dropCollection(Image)
operations.insert(new Image([
id : '1',
name: 'learning-spring-boot-cover.jpg'
]))
operations.insert(new Image([
id : '2',
name: 'learning-spring-boot-2nd-edition.jpg'
]))
operations.insert(new Image([
id : '3',
name: 'bazinga.png'
]))
operations.findAll(Image).each println it


@Test
void findAllShouldWork()
Flux<Image> images = repository.findAll()
StepVerifier.create(images)
.recordWith( new ArrayList<>() )
.expectNextCount(3)
.consumeRecordedWith(

assertThat(it).hasSize(3)
assertThat(it)
.extracting(it.name)
.contains(
'learning-spring-boot-cover.jpg',
'learning-spring-boot-2nd-edition.jpg',
'bazinga.png')
)
.expectComplete()
.verify()




The test fails and the offending line is this after some



.extracting(it.name)


When it is changed to



.extracting('name')


Then the test passes. Has anybody had the same problem with using assert J and groovy and step verifier?










share|improve this question
























  • what exception do you have?

    – daggett
    Mar 27 at 10:53













0












0








0








I'm encountering a weird issue / bug with assert j and groovy with step verifier testing mongo db. I've included some code to help you reproduce this locally and also I have made the test work by replacing the closure with just a string.



I have the following code:



 @Document
@ToString(includePackage = false, includeFields = true)
class Image
@Id private String id
private String name

Image()


Image(String id, String name)
this.id = id
this.name = name


String getId()
return id


void setId(String id)
this.id = id


String getName()
return name


void setName(String name)
this.name = name




ImageRepository.groovy



interface ImageRepository extends ReactiveCrudRepository<Image, String>
Mono<Image> findByName(String name)



and the following test



@RunWith(SpringRunner)
@DataMongoTest
class EmbeddedImageRepositoryTests

@Autowired
ImageRepository repository

@Autowired
MongoOperations operations

@Before
void setup()
operations.dropCollection(Image)
operations.insert(new Image([
id : '1',
name: 'learning-spring-boot-cover.jpg'
]))
operations.insert(new Image([
id : '2',
name: 'learning-spring-boot-2nd-edition.jpg'
]))
operations.insert(new Image([
id : '3',
name: 'bazinga.png'
]))
operations.findAll(Image).each println it


@Test
void findAllShouldWork()
Flux<Image> images = repository.findAll()
StepVerifier.create(images)
.recordWith( new ArrayList<>() )
.expectNextCount(3)
.consumeRecordedWith(

assertThat(it).hasSize(3)
assertThat(it)
.extracting(it.name)
.contains(
'learning-spring-boot-cover.jpg',
'learning-spring-boot-2nd-edition.jpg',
'bazinga.png')
)
.expectComplete()
.verify()




The test fails and the offending line is this after some



.extracting(it.name)


When it is changed to



.extracting('name')


Then the test passes. Has anybody had the same problem with using assert J and groovy and step verifier?










share|improve this question














I'm encountering a weird issue / bug with assert j and groovy with step verifier testing mongo db. I've included some code to help you reproduce this locally and also I have made the test work by replacing the closure with just a string.



I have the following code:



 @Document
@ToString(includePackage = false, includeFields = true)
class Image
@Id private String id
private String name

Image()


Image(String id, String name)
this.id = id
this.name = name


String getId()
return id


void setId(String id)
this.id = id


String getName()
return name


void setName(String name)
this.name = name




ImageRepository.groovy



interface ImageRepository extends ReactiveCrudRepository<Image, String>
Mono<Image> findByName(String name)



and the following test



@RunWith(SpringRunner)
@DataMongoTest
class EmbeddedImageRepositoryTests

@Autowired
ImageRepository repository

@Autowired
MongoOperations operations

@Before
void setup()
operations.dropCollection(Image)
operations.insert(new Image([
id : '1',
name: 'learning-spring-boot-cover.jpg'
]))
operations.insert(new Image([
id : '2',
name: 'learning-spring-boot-2nd-edition.jpg'
]))
operations.insert(new Image([
id : '3',
name: 'bazinga.png'
]))
operations.findAll(Image).each println it


@Test
void findAllShouldWork()
Flux<Image> images = repository.findAll()
StepVerifier.create(images)
.recordWith( new ArrayList<>() )
.expectNextCount(3)
.consumeRecordedWith(

assertThat(it).hasSize(3)
assertThat(it)
.extracting(it.name)
.contains(
'learning-spring-boot-cover.jpg',
'learning-spring-boot-2nd-edition.jpg',
'bazinga.png')
)
.expectComplete()
.verify()




The test fails and the offending line is this after some



.extracting(it.name)


When it is changed to



.extracting('name')


Then the test passes. Has anybody had the same problem with using assert J and groovy and step verifier?







groovy assertj






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 27 at 1:40









johnwick0831johnwick0831

2743 silver badges17 bronze badges




2743 silver badges17 bronze badges















  • what exception do you have?

    – daggett
    Mar 27 at 10:53

















  • what exception do you have?

    – daggett
    Mar 27 at 10:53
















what exception do you have?

– daggett
Mar 27 at 10:53





what exception do you have?

– daggett
Mar 27 at 10:53












1 Answer
1






active

oldest

votes


















0














I haven't used AssertJ with groovy but my guess is Groovy is confused when resolving which extracting methods to use, if I had to pick the ones confusing Groovy I would pick:




  • https://static.javadoc.io/org.assertj/assertj-core/3.12.2/org/assertj/core/api/AbstractIterableAssert.html#extracting-java.util.function.Function-

  • https://static.javadoc.io/org.assertj/assertj-core/3.12.2/org/assertj/core/api/AbstractIterableAssert.html#extracting-org.assertj.core.api.iterable.ThrowingExtractor-

but you have a few more overloaded extracting in https://static.javadoc.io/org.assertj/assertj-core/3.12.2/org/assertj/core/api/AbstractIterableAssert.html#method.summary.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55368558%2fassertj-and-groovy-not-playing-nicely-together%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    I haven't used AssertJ with groovy but my guess is Groovy is confused when resolving which extracting methods to use, if I had to pick the ones confusing Groovy I would pick:




    • https://static.javadoc.io/org.assertj/assertj-core/3.12.2/org/assertj/core/api/AbstractIterableAssert.html#extracting-java.util.function.Function-

    • https://static.javadoc.io/org.assertj/assertj-core/3.12.2/org/assertj/core/api/AbstractIterableAssert.html#extracting-org.assertj.core.api.iterable.ThrowingExtractor-

    but you have a few more overloaded extracting in https://static.javadoc.io/org.assertj/assertj-core/3.12.2/org/assertj/core/api/AbstractIterableAssert.html#method.summary.






    share|improve this answer





























      0














      I haven't used AssertJ with groovy but my guess is Groovy is confused when resolving which extracting methods to use, if I had to pick the ones confusing Groovy I would pick:




      • https://static.javadoc.io/org.assertj/assertj-core/3.12.2/org/assertj/core/api/AbstractIterableAssert.html#extracting-java.util.function.Function-

      • https://static.javadoc.io/org.assertj/assertj-core/3.12.2/org/assertj/core/api/AbstractIterableAssert.html#extracting-org.assertj.core.api.iterable.ThrowingExtractor-

      but you have a few more overloaded extracting in https://static.javadoc.io/org.assertj/assertj-core/3.12.2/org/assertj/core/api/AbstractIterableAssert.html#method.summary.






      share|improve this answer



























        0












        0








        0







        I haven't used AssertJ with groovy but my guess is Groovy is confused when resolving which extracting methods to use, if I had to pick the ones confusing Groovy I would pick:




        • https://static.javadoc.io/org.assertj/assertj-core/3.12.2/org/assertj/core/api/AbstractIterableAssert.html#extracting-java.util.function.Function-

        • https://static.javadoc.io/org.assertj/assertj-core/3.12.2/org/assertj/core/api/AbstractIterableAssert.html#extracting-org.assertj.core.api.iterable.ThrowingExtractor-

        but you have a few more overloaded extracting in https://static.javadoc.io/org.assertj/assertj-core/3.12.2/org/assertj/core/api/AbstractIterableAssert.html#method.summary.






        share|improve this answer













        I haven't used AssertJ with groovy but my guess is Groovy is confused when resolving which extracting methods to use, if I had to pick the ones confusing Groovy I would pick:




        • https://static.javadoc.io/org.assertj/assertj-core/3.12.2/org/assertj/core/api/AbstractIterableAssert.html#extracting-java.util.function.Function-

        • https://static.javadoc.io/org.assertj/assertj-core/3.12.2/org/assertj/core/api/AbstractIterableAssert.html#extracting-org.assertj.core.api.iterable.ThrowingExtractor-

        but you have a few more overloaded extracting in https://static.javadoc.io/org.assertj/assertj-core/3.12.2/org/assertj/core/api/AbstractIterableAssert.html#method.summary.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 28 at 0:12









        Joel CostigliolaJoel Costigliola

        2,37511 silver badges20 bronze badges




        2,37511 silver badges20 bronze badges





















            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







            Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55368558%2fassertj-and-groovy-not-playing-nicely-together%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript