2016-09-07 5 views
0

に入力されたデータを解析:スポック:エラー、私は、次の場所をブロックしていた場合、ブロック

where: 
    [area,country,port,dest_area,dest_country,dest_port] << ["アジア" , "日本", "東京(成田・羽田)", "アジア" ,"韓国" , "ソウル"] 

そして、このようなエラーを取得する:

java.lang.StringIndexOutOfBoundsException: String index out of range: 4 
at jp.co.skygate.groovy.test.AOSearchPageExternalInputDataTest.Select origin(AOSearchPageExternalInputDataTest.groovy:105) 

java.lang.StringIndexOutOfBoundsException: String index out of range: 3 
at jp.co.skygate.groovy.test.AOSearchPageExternalInputDataTest.Select origin(AOSearchPageExternalInputDataTest.groovy:105) 

間違いがありますか?

+0

ポストユニットテストの全ソースコードだけでなく、ここで:ブロック – kazanaki

答えて

0

解決策が見つかりました。問題は、 のブロックでは、すべての変数に値のリストが設定されています。

where: 
    [area,country,port,dest_area,dest_country,dest_port] << ["アジア" , "日本", "東京(成田・羽田)", "アジア" ,"韓国" , "ソウル"] 

は次のようにすべきである:

where: 
[area] << ["アジア" ] 
[country] << ["日本"] 
[port] << ["東京(成田・羽田)"] 
[dest_area,] << ["アジア"] 
[dest_country] << ["韓国"] 
[dest_port] << ["ソウル"] 
関連する問題