|
20 | 20 |
|
21 | 21 | describe LogStash::Setting::Nullable do |
22 | 22 | let(:setting_name) { "this.that" } |
23 | | - let(:normal_setting) { LogStash::Setting::String.new(setting_name, nil, false, possible_strings) } |
| 23 | + let(:normal_setting) { LogStash::Setting::StringSetting.new(setting_name, nil, false, possible_strings) } |
24 | 24 | let(:possible_strings) { [] } # empty means any string passes |
25 | 25 |
|
26 | 26 | subject(:nullable_setting) { normal_setting.nullable } |
27 | 27 |
|
28 | 28 | it 'is a kind of Nullable' do |
29 | | - expect(nullable_setting).to be_a_kind_of(described_class) |
| 29 | + expect(nullable_setting).to be_a_kind_of(LogStash::Setting::NullableSetting) |
30 | 30 | end |
31 | 31 |
|
32 | 32 | it "retains the wrapped setting's name" do |
|
56 | 56 | context 'to an invalid wrong-type value' do |
57 | 57 | let(:candidate_value) { 127 } # wrong type, expects String |
58 | 58 | it 'is an invalid setting' do |
59 | | - expect { nullable_setting.validate_value }.to raise_error(ArgumentError, a_string_including("Setting \"#{setting_name}\" must be a ")) |
| 59 | + expect { nullable_setting.validate_value }.to raise_error(java.lang.ClassCastException, a_string_including("class java.lang.Long cannot be cast to class java.lang.String")) |
60 | 60 | end |
61 | 61 | end |
62 | 62 | context 'to an invalid value not in the allow-list' do |
63 | 63 | let(:possible_strings) { %w(this that)} |
64 | 64 | let(:candidate_value) { "another" } # wrong type, expects String |
65 | 65 | it 'is an invalid setting' do |
66 | | - expect { nullable_setting.validate_value }.to raise_error(ArgumentError, a_string_including("Invalid value")) |
| 66 | + expect { nullable_setting.validate_value }.to raise_error(java.lang.IllegalArgumentException, a_string_including("Invalid value")) |
67 | 67 | end |
68 | 68 | end |
69 | 69 | context 'to a valid value' do |
|
0 commit comments