Merge pull request #31694 from quaff

* pr/31694:
  Upgrade copyright year of changed file
  Use AssertJ isInstanceOf where feasible

Closes gh-31694
This commit is contained in:
Stéphane Nicoll
2023-11-28 12:58:14 +01:00
2 changed files with 6 additions and 6 deletions

View File

@@ -117,14 +117,14 @@ class ConversionServiceFactoryBeanTests {
private void doTestConversionServiceInApplicationContext(String fileName, Class<?> resourceClass) {
ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext(fileName, getClass());
ResourceTestBean tb = ctx.getBean("resourceTestBean", ResourceTestBean.class);
assertThat(resourceClass.isInstance(tb.getResource())).isTrue();
assertThat(tb.getResource()).isInstanceOf(resourceClass);
assertThat(tb.getResourceArray()).hasSize(1);
assertThat(resourceClass.isInstance(tb.getResourceArray()[0])).isTrue();
assertThat(tb.getResourceArray()[0]).isInstanceOf(resourceClass);
assertThat(tb.getResourceMap()).hasSize(1);
assertThat(resourceClass.isInstance(tb.getResourceMap().get("key1"))).isTrue();
assertThat(tb.getResourceMap().get("key1")).isInstanceOf(resourceClass);
assertThat(tb.getResourceArrayMap()).hasSize(1);
assertThat(tb.getResourceArrayMap().get("key1")).isNotEmpty();
assertThat(resourceClass.isInstance(tb.getResourceArrayMap().get("key1")[0])).isTrue();
assertThat(tb.getResourceArrayMap().get("key1")[0]).isInstanceOf(resourceClass);
ctx.close();
}

View File

@@ -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.
@@ -243,7 +243,7 @@ public class HandlersBeanDefinitionParserTests {
if (handler instanceof WebSocketHandlerDecorator) {
handler = ((WebSocketHandlerDecorator) handler).getLastHandler();
}
assertThat(handlerClass.isInstance(handler)).isTrue();
assertThat(handler).isInstanceOf(handlerClass);
}
}