Index: trunk/test/unit/org/openstreetmap/josm/io/imagery/WMSImageryTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/imagery/WMSImageryTest.java	(revision 14410)
+++ trunk/test/unit/org/openstreetmap/josm/io/imagery/WMSImageryTest.java	(revision 14411)
@@ -118,5 +118,16 @@
         assertEquals("bag:Matching Street", wms.getLayers().get(0).getChildren().get(0).getName());
         assertEquals("Dichtstbijzijnde straat", wms.getLayers().get(0).getChildren().get(0).getTitle());
+    }
 
+    @Test
+    public void testForTitleWithinAttribution_ticket16940() throws IOException, WMSGetCapabilitiesException {
+        tileServer.stubFor(
+                WireMock.get(WireMock.anyUrl())
+                .willReturn(WireMock.aResponse().withBody(
+                        Files.readAllBytes(Paths.get(TestUtils.getRegressionDataFile(16940, "capabilities.xml")))
+                ))
+        );
+        WMSImagery wms = new WMSImagery(tileServer.url("any"));
+        assertEquals("Hipsográfico", wms.getLayers().stream().findFirst().get().getTitle());
     }
 }
