Skip to content

Commit 707eb70

Browse files
committed
Polishing
1 parent 2c97996 commit 707eb70

File tree

3 files changed

+25
-27
lines changed

3 files changed

+25
-27
lines changed

spring-context/src/main/java/org/springframework/context/annotation/ImportRuntimeHints.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -44,7 +44,6 @@
4444
* public MyService myService() {
4545
* return new MyService();
4646
* }
47-
*
4847
* }</pre>
4948
*
5049
* <p>If the configuration class above is processed, {@code MyHints} will be

spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,8 +1086,8 @@ public Object invoke(MethodInvocation mi) throws Throwable {
10861086
// NameReverter saved it back
10871087
assertThat(it.getName()).isEqualTo(name1);
10881088
assertThat(saver.names).hasSize(2);
1089-
assertThat(saver.names.get(0)).isEqualTo(name2);
1090-
assertThat(saver.names.get(1)).isEqualTo(name1);
1089+
assertThat(saver.names).element(0).isEqualTo(name2);
1090+
assertThat(saver.names).element(1).isEqualTo(name1);
10911091
}
10921092

10931093
@SuppressWarnings("serial")
@@ -1178,7 +1178,7 @@ public void testEquals() {
11781178
assertThat(i2).isEqualTo(i1);
11791179
assertThat(proxyB).isEqualTo(proxyA);
11801180
assertThat(proxyB.hashCode()).isEqualTo(proxyA.hashCode());
1181-
assertThat(proxyA.equals(a)).isFalse();
1181+
assertThat(proxyA).isNotEqualTo(a);
11821182

11831183
// Equality checks were handled by the proxy
11841184
assertThat(i1.getCount()).isEqualTo(0);
@@ -1187,7 +1187,7 @@ public void testEquals() {
11871187
// and won't think it's equal to B's NopInterceptor
11881188
proxyA.absquatulate();
11891189
assertThat(i1.getCount()).isEqualTo(1);
1190-
assertThat(proxyA.equals(proxyB)).isFalse();
1190+
assertThat(proxyA).isNotEqualTo(proxyB);
11911191
}
11921192

11931193
@Test
@@ -1874,6 +1874,14 @@ public Class<?> getTargetClass() {
18741874
return target.getClass();
18751875
}
18761876

1877+
/**
1878+
* @see org.springframework.aop.TargetSource#isStatic()
1879+
*/
1880+
@Override
1881+
public boolean isStatic() {
1882+
return false;
1883+
}
1884+
18771885
/**
18781886
* @see org.springframework.aop.TargetSource#getTarget()
18791887
*/
@@ -1903,19 +1911,10 @@ public void verify() {
19031911
throw new RuntimeException("Expectation failed: " + gets + " gets and " + releases + " releases");
19041912
}
19051913
}
1906-
1907-
/**
1908-
* @see org.springframework.aop.TargetSource#isStatic()
1909-
*/
1910-
@Override
1911-
public boolean isStatic() {
1912-
return false;
1913-
}
1914-
19151914
}
19161915

19171916

1918-
static abstract class ExposedInvocationTestBean extends TestBean {
1917+
abstract static class ExposedInvocationTestBean extends TestBean {
19191918

19201919
@Override
19211920
public String getName() {

spring-context/src/test/java/org/springframework/context/support/GenericApplicationContextTests.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,16 @@ void accessAfterClosing() {
126126

127127
assertThat(context.getBean(String.class)).isSameAs(context.getBean("testBean"));
128128
assertThat(context.getAutowireCapableBeanFactory().getBean(String.class))
129-
.isSameAs(context.getAutowireCapableBeanFactory().getBean("testBean"));
129+
.isSameAs(context.getAutowireCapableBeanFactory().getBean("testBean"));
130130

131131
context.close();
132132

133133
assertThatIllegalStateException()
134-
.isThrownBy(() -> context.getBean(String.class));
134+
.isThrownBy(() -> context.getBean(String.class));
135135
assertThatIllegalStateException()
136-
.isThrownBy(() -> context.getAutowireCapableBeanFactory().getBean(String.class));
136+
.isThrownBy(() -> context.getAutowireCapableBeanFactory().getBean(String.class));
137137
assertThatIllegalStateException()
138-
.isThrownBy(() -> context.getAutowireCapableBeanFactory().getBean("testBean"));
138+
.isThrownBy(() -> context.getAutowireCapableBeanFactory().getBean("testBean"));
139139
}
140140

141141
@Test
@@ -236,9 +236,9 @@ void individualBeanWithNullReturningSupplier() {
236236
assertThat(context.getBeanNamesForType(BeanB.class)).containsExactly("b");
237237
assertThat(context.getBeanNamesForType(BeanC.class)).containsExactly("c");
238238
assertThat(context.getBeansOfType(BeanA.class)).isEmpty();
239-
assertThat(context.getBeansOfType(BeanB.class).values().iterator().next())
239+
assertThat(context.getBeansOfType(BeanB.class).values()).element(0)
240240
.isSameAs(context.getBean(BeanB.class));
241-
assertThat(context.getBeansOfType(BeanC.class).values().iterator().next())
241+
assertThat(context.getBeansOfType(BeanC.class).values()).element(0)
242242
.isSameAs(context.getBean(BeanC.class));
243243
}
244244

@@ -281,8 +281,8 @@ private void assertGetResourceSemantics(ResourceLoader resourceLoader, Class<? e
281281
// java.nio.file.InvalidPathException: Illegal char <:> at index 4: ping:foo
282282
if (resourceLoader instanceof FileSystemResourceLoader && OS.WINDOWS.isCurrentOs()) {
283283
assertThatExceptionOfType(InvalidPathException.class)
284-
.isThrownBy(() -> context.getResource(pingLocation))
285-
.withMessageContaining(pingLocation);
284+
.isThrownBy(() -> context.getResource(pingLocation))
285+
.withMessageContaining(pingLocation);
286286
}
287287
else {
288288
resource = context.getResource(pingLocation);
@@ -297,8 +297,8 @@ private void assertGetResourceSemantics(ResourceLoader resourceLoader, Class<? e
297297
assertThat(resource).isInstanceOf(FileUrlResource.class);
298298
resource = context.getResource(pingLocation);
299299
assertThat(resource).asInstanceOf(type(ByteArrayResource.class))
300-
.extracting(bar -> new String(bar.getByteArray(), UTF_8))
301-
.isEqualTo("pong:foo");
300+
.extracting(bar -> new String(bar.getByteArray(), UTF_8))
301+
.isEqualTo("pong:foo");
302302
}
303303

304304
@Test
@@ -536,7 +536,7 @@ public BeanA(BeanB b, BeanC c) {
536536
}
537537
}
538538

539-
static class BeanB implements ApplicationContextAware {
539+
static class BeanB implements ApplicationContextAware {
540540

541541
ApplicationContext applicationContext;
542542

0 commit comments

Comments
 (0)