コード例 #1
0
 @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"));
 }
コード例 #2
0
 @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");
 }