2727import org .junit .jupiter .api .BeforeEach ;
2828import org .junit .jupiter .api .Test ;
2929
30- public class SimpleNamespaceContextTest {
30+ class SimpleNamespaceContextTest {
3131
3232 private SimpleNamespaceContext context ;
3333
3434 @ BeforeEach
35- public void setUp () throws Exception {
36-
35+ void setUp () {
3736 context = new SimpleNamespaceContext ();
3837 context .bindNamespaceUri ("prefix" , "namespaceURI" );
3938 }
4039
4140 @ Test
42- public void testGetNamespaceURI () {
41+ void testGetNamespaceURI () {
4342
44- assertThat (context .getNamespaceURI (XMLConstants .DEFAULT_NS_PREFIX )).isEqualTo ( "" );
43+ assertThat (context .getNamespaceURI (XMLConstants .DEFAULT_NS_PREFIX )).isEmpty ( );
4544
4645 String defaultNamespaceUri = "defaultNamespace" ;
4746 context .bindNamespaceUri (XMLConstants .DEFAULT_NS_PREFIX , defaultNamespaceUri );
4847
4948 assertThat (context .getNamespaceURI (XMLConstants .DEFAULT_NS_PREFIX )).isEqualTo (defaultNamespaceUri );
5049 assertThat (context .getNamespaceURI ("prefix" )).isEqualTo ("namespaceURI" );
51- assertThat (context .getNamespaceURI ("unbound" )).isEqualTo ( "" );
50+ assertThat (context .getNamespaceURI ("unbound" )).isEmpty ( );
5251 assertThat (context .getNamespaceURI (XMLConstants .XML_NS_PREFIX )).isEqualTo (XMLConstants .XML_NS_URI );
5352 assertThat (context .getNamespaceURI (XMLConstants .XMLNS_ATTRIBUTE )).isEqualTo (XMLConstants .XMLNS_ATTRIBUTE_NS_URI );
5453 }
5554
5655 @ Test
57- public void testGetPrefix () {
56+ void testGetPrefix () {
5857
5958 context .bindDefaultNamespaceUri ("defaultNamespaceURI" );
6059
@@ -66,7 +65,7 @@ public void testGetPrefix() {
6665 }
6766
6867 @ Test
69- public void testGetPrefixes () {
68+ void testGetPrefixes () {
7069
7170 context .bindDefaultNamespaceUri ("defaultNamespaceURI" );
7271
@@ -78,22 +77,18 @@ public void testGetPrefixes() {
7877 }
7978
8079 @ Test
81- public void unmodifiableGetPrefixes () {
82-
83- assertThatExceptionOfType (UnsupportedOperationException .class ).isThrownBy (() -> {
84-
85- String namespaceUri = "namespaceUri" ;
86- context .bindNamespaceUri ("prefix1" , namespaceUri );
87- context .bindNamespaceUri ("prefix2" , namespaceUri );
80+ void unmodifiableGetPrefixes () {
81+ String namespaceUri = "namespaceUri" ;
82+ context .bindNamespaceUri ("prefix1" , namespaceUri );
83+ context .bindNamespaceUri ("prefix2" , namespaceUri );
8884
89- Iterator <String > prefixes = context .getPrefixes (namespaceUri );
90- prefixes .next ();
91- prefixes .remove ();
92- });
85+ Iterator <String > prefixes = context .getPrefixes (namespaceUri );
86+ prefixes .next ();
87+ assertThatExceptionOfType (UnsupportedOperationException .class ).isThrownBy (prefixes ::remove );
9388 }
9489
9590 @ Test
96- public void testMultiplePrefixes () {
91+ void testMultiplePrefixes () {
9792
9893 context .bindNamespaceUri ("prefix1" , "namespace" );
9994 context .bindNamespaceUri ("prefix2" , "namespace" );
@@ -130,7 +125,7 @@ private void assertPrefixes(String namespaceUri, String prefix) {
130125 }
131126
132127 @ Test
133- public void testGetBoundPrefixes () {
128+ void testGetBoundPrefixes () {
134129
135130 Iterator <String > iterator = context .getBoundPrefixes ();
136131
@@ -144,15 +139,15 @@ public void testGetBoundPrefixes() {
144139 }
145140
146141 @ Test
147- public void testSetBindings () {
142+ void testSetBindings () {
148143
149144 context .setBindings (Collections .singletonMap ("prefix" , "namespace" ));
150145
151146 assertThat (context .getNamespaceURI ("prefix" )).isEqualTo ("namespace" );
152147 }
153148
154149 @ Test
155- public void testRemoveBinding () {
150+ void testRemoveBinding () {
156151
157152 context .clear ();
158153
@@ -175,7 +170,7 @@ public void testRemoveBinding() {
175170 }
176171
177172 @ Test
178- public void testHasBinding () {
173+ void testHasBinding () {
179174
180175 context .clear ();
181176
@@ -190,7 +185,7 @@ public void testHasBinding() {
190185 }
191186
192187 @ Test
193- public void testDefaultNamespaceMultiplePrefixes () {
188+ void testDefaultNamespaceMultiplePrefixes () {
194189
195190 String defaultNamespace = "http://springframework.org/spring-ws" ;
196191
0 commit comments