DataTable asMap List Map Row Order

357 views
Skip to first unread message

Rich Crook

unread,
Jan 28, 2015, 8:11:06 PM1/28/15
to cu...@googlegroups.com

Given I have the following DataTable:

    Then the List of Film grid details for this Film should be:

      | Film Title              | Banner                          | Status   |

      | Z MY TEST FILM | My Great Film Company | Pending |


I would have expected after transforming it via: 

Then(~'^the List of Film grid details for this Film should be:$') { DataTable expectedFilmGridTable ->

List<Map<String,String>> FilmGridData  = expectedFilmGridTable.asMaps(String.class, String.class)

…that an inspection of the 'expectedFilmGridTable' Object would be something like:

[0] = {java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntry@xxxx}"Film Title" -> "Z MY TEST FILM"

[1] = {java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntry@xxxx}"Status" -> "Pending"

[2] = {java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntry@xxxx}"Banner" -> "My Great Film Company"

But in fact it is:

[0] = {java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntry@xxxx}"Status" -> "Pending"

[1] = {java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntry@xxxx}"Film Title" -> "Z MY TEST FILM"

[2] = {java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntry@xxxx}"Banner" -> "My Great Film Company"


In fact for every DataTable I create the first two items are “flipped” and the rest remain in order.

I am doing something wrong or might this be a bug in Cucumber? Should I somehow be using a LinkedHashMap instead?

  

Thanks,

Rich

aslak hellesoy

unread,
Jan 28, 2015, 8:50:49 PM1/28/15
to Cucumber Users
The subject of your email is about row order. Did you mean column order?

On Thu, Jan 29, 2015 at 1:11 AM, Rich Crook <homeb...@gmail.com> wrote:

Given I have the following DataTable:

    Then the List of Film grid details for this Film should be:

      | Film Title              | Banner                          | Status   |

      | Z MY TEST FILM | My Great Film Company | Pending |


I would have expected after transforming it via: 

Then(~'^the List of Film grid details for this Film should be:$') { DataTable expectedFilmGridTable ->

List<Map<String,String>> FilmGridData  = expectedFilmGridTable.asMaps(String.class, String.class)

…that an inspection of the 'expectedFilmGridTable' Object would be something like:


Did you mean the map which is the 0th element of the FilmGridData list here?
 

[0] = {java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntry@xxxx}"Film Title" -> "Z MY TEST FILM"

[1] = {java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntry@xxxx}"Status" -> "Pending"

[2] = {java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntry@xxxx}"Banner" -> "My Great Film Company"

But in fact it is:

[0] = {java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntry@xxxx}"Status" -> "Pending"

[1] = {java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntry@xxxx}"Film Title" -> "Z MY TEST FILM"

[2] = {java.util.Collections$UnmodifiableMap$UnmodifiableEntrySet$UnmodifiableEntry@xxxx}"Banner" -> "My Great Film Company"


In fact for every DataTable I create the first two items are “flipped” and the rest remain in order.


I am doing something wrong or might this be a bug in Cucumber? Should I somehow be using a LinkedHashMap instead?


I believe this was fixed in 1.2.0:

Are you using an older version?

Cheers,
Aslak

  

Thanks,

Rich

--
Posting rules: http://cukes.info/posting-rules.html
---
You received this message because you are subscribed to the Google Groups "Cukes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cukes+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rich Crook

unread,
Jan 28, 2015, 9:16:55 PM1/28/15
to cu...@googlegroups.com
Yes! Sorry about that

Rich Crook

unread,
Jan 28, 2015, 9:24:46 PM1/28/15
to cu...@googlegroups.com
Yes I am using 1.1.8
Yup 1.2.0 work just fine thanks!


On Wednesday, January 28, 2015 at 5:50:49 PM UTC-8, Aslak Hellesøy wrote:
Reply all
Reply to author
Forward
0 new messages