Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoeller committed Dec 12, 2023
1 parent 2c97996 commit 707eb70
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 27 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -44,7 +44,6 @@
* public MyService myService() {
* return new MyService();
* }
*
* }</pre>
*
* <p>If the configuration class above is processed, {@code MyHints} will be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1086,8 +1086,8 @@ public Object invoke(MethodInvocation mi) throws Throwable {
// NameReverter saved it back
assertThat(it.getName()).isEqualTo(name1);
assertThat(saver.names).hasSize(2);
assertThat(saver.names.get(0)).isEqualTo(name2);
assertThat(saver.names.get(1)).isEqualTo(name1);
assertThat(saver.names).element(0).isEqualTo(name2);
assertThat(saver.names).element(1).isEqualTo(name1);
}

@SuppressWarnings("serial")
Expand Down Expand Up @@ -1178,7 +1178,7 @@ public void testEquals() {
assertThat(i2).isEqualTo(i1);
assertThat(proxyB).isEqualTo(proxyA);
assertThat(proxyB.hashCode()).isEqualTo(proxyA.hashCode());
assertThat(proxyA.equals(a)).isFalse();
assertThat(proxyA).isNotEqualTo(a);

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

@Test
Expand Down Expand Up @@ -1874,6 +1874,14 @@ public Class<?> getTargetClass() {
return target.getClass();
}

/**
* @see org.springframework.aop.TargetSource#isStatic()
*/
@Override
public boolean isStatic() {
return false;
}

/**
* @see org.springframework.aop.TargetSource#getTarget()
*/
Expand Down Expand Up @@ -1903,19 +1911,10 @@ public void verify() {
throw new RuntimeException("Expectation failed: " + gets + " gets and " + releases + " releases");
}
}

/**
* @see org.springframework.aop.TargetSource#isStatic()
*/
@Override
public boolean isStatic() {
return false;
}

}


static abstract class ExposedInvocationTestBean extends TestBean {
abstract static class ExposedInvocationTestBean extends TestBean {

@Override
public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,16 @@ void accessAfterClosing() {

assertThat(context.getBean(String.class)).isSameAs(context.getBean("testBean"));
assertThat(context.getAutowireCapableBeanFactory().getBean(String.class))
.isSameAs(context.getAutowireCapableBeanFactory().getBean("testBean"));
.isSameAs(context.getAutowireCapableBeanFactory().getBean("testBean"));

context.close();

assertThatIllegalStateException()
.isThrownBy(() -> context.getBean(String.class));
.isThrownBy(() -> context.getBean(String.class));
assertThatIllegalStateException()
.isThrownBy(() -> context.getAutowireCapableBeanFactory().getBean(String.class));
.isThrownBy(() -> context.getAutowireCapableBeanFactory().getBean(String.class));
assertThatIllegalStateException()
.isThrownBy(() -> context.getAutowireCapableBeanFactory().getBean("testBean"));
.isThrownBy(() -> context.getAutowireCapableBeanFactory().getBean("testBean"));
}

@Test
Expand Down Expand Up @@ -236,9 +236,9 @@ void individualBeanWithNullReturningSupplier() {
assertThat(context.getBeanNamesForType(BeanB.class)).containsExactly("b");
assertThat(context.getBeanNamesForType(BeanC.class)).containsExactly("c");
assertThat(context.getBeansOfType(BeanA.class)).isEmpty();
assertThat(context.getBeansOfType(BeanB.class).values().iterator().next())
assertThat(context.getBeansOfType(BeanB.class).values()).element(0)
.isSameAs(context.getBean(BeanB.class));
assertThat(context.getBeansOfType(BeanC.class).values().iterator().next())
assertThat(context.getBeansOfType(BeanC.class).values()).element(0)
.isSameAs(context.getBean(BeanC.class));
}

Expand Down Expand Up @@ -281,8 +281,8 @@ private void assertGetResourceSemantics(ResourceLoader resourceLoader, Class<? e
// java.nio.file.InvalidPathException: Illegal char <:> at index 4: ping:foo
if (resourceLoader instanceof FileSystemResourceLoader && OS.WINDOWS.isCurrentOs()) {
assertThatExceptionOfType(InvalidPathException.class)
.isThrownBy(() -> context.getResource(pingLocation))
.withMessageContaining(pingLocation);
.isThrownBy(() -> context.getResource(pingLocation))
.withMessageContaining(pingLocation);
}
else {
resource = context.getResource(pingLocation);
Expand All @@ -297,8 +297,8 @@ private void assertGetResourceSemantics(ResourceLoader resourceLoader, Class<? e
assertThat(resource).isInstanceOf(FileUrlResource.class);
resource = context.getResource(pingLocation);
assertThat(resource).asInstanceOf(type(ByteArrayResource.class))
.extracting(bar -> new String(bar.getByteArray(), UTF_8))
.isEqualTo("pong:foo");
.extracting(bar -> new String(bar.getByteArray(), UTF_8))
.isEqualTo("pong:foo");
}

@Test
Expand Down Expand Up @@ -536,7 +536,7 @@ public BeanA(BeanB b, BeanC c) {
}
}

static class BeanB implements ApplicationContextAware {
static class BeanB implements ApplicationContextAware {

ApplicationContext applicationContext;

Expand Down

0 comments on commit 707eb70

Please sign in to comment.