@Test public void testAddressBinding() throws Exception { RelaxedDataBinder binder = new RelaxedDataBinder(this.properties, "server"); binder.bind(new MutablePropertyValues(Collections.singletonMap("server.address", "127.0.0.1"))); assertThat(binder.getBindingResult().hasErrors()).isFalse(); assertThat(this.properties.getAddress()).isEqualTo(InetAddress.getByName("127.0.0.1")); }
@Test public void testServletPathAsPrefix() throws Exception { RelaxedDataBinder binder = new RelaxedDataBinder(this.properties, "server"); binder.bind(new MutablePropertyValues(Collections.singletonMap("server.servletPath", "/foo"))); assertThat(binder.getBindingResult().hasErrors()).isFalse(); assertThat(this.properties.getServletMapping()).isEqualTo("/foo/*"); assertThat(this.properties.getServletPrefix()).isEqualTo("/foo"); }