//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void badDurationMissingNumber() internal virtual void BadDurationMissingNumber() { Setting <Duration> setting = buildSetting("foo.bar", DURATION).build(); InvalidSettingException exception = assertThrows(typeof(InvalidSettingException), () => setting.apply(Map(stringMap("foo.bar", "ms")))); assertThat(exception.Message, containsString("Missing numeric value")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void badDurationInvalidUnit() internal virtual void BadDurationInvalidUnit() { Setting <Duration> setting = buildSetting("foo.bar", DURATION).build(); InvalidSettingException exception = assertThrows(typeof(InvalidSettingException), () => setting.apply(Map(stringMap("foo.bar", "2gigaseconds")))); assertThat(exception.Message, containsString("Unrecognized unit 'gigaseconds'")); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void exceptDoesNotAllowForbiddenValues() internal virtual void ExceptDoesNotAllowForbiddenValues() { Setting <string> restrictedSetting = buildSetting("foo", STRING, "test").constraint(except("a", "b", "c")).build(); assertEquals("test", restrictedSetting.apply(Map(stringMap()))); assertEquals("d", restrictedSetting.apply(Map(stringMap("foo", "d")))); assertThrows(typeof(InvalidSettingException), () => restrictedSetting.apply(Map(stringMap("foo", "a")))); assertThrows(typeof(InvalidSettingException), () => restrictedSetting.apply(Map(stringMap("foo", "b")))); InvalidSettingException exception = assertThrows(typeof(InvalidSettingException), () => restrictedSetting.apply(Map(stringMap("foo", "c")))); assertThat(exception.Message, containsString("not allowed value is: c")); }