Polishing
This commit is contained in:
parent
0a9c768b81
commit
afc398333e
|
@ -197,7 +197,7 @@ class BeanUtilsTests {
|
|||
}
|
||||
|
||||
@Test
|
||||
void testCopyPropertiesWithEditable() throws Exception {
|
||||
void copyPropertiesWithEditable() throws Exception {
|
||||
TestBean tb = new TestBean();
|
||||
assertThat(tb.getName() == null).as("Name empty").isTrue();
|
||||
tb.setAge(32);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2020 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.
|
||||
|
@ -36,25 +36,23 @@ class SpringFactoriesLoaderTests {
|
|||
@Test
|
||||
void loadFactoriesInCorrectOrder() {
|
||||
List<DummyFactory> factories = SpringFactoriesLoader.loadFactories(DummyFactory.class, null);
|
||||
assertThat(factories.size()).isEqualTo(2);
|
||||
boolean condition1 = factories.get(0) instanceof MyDummyFactory1;
|
||||
assertThat(condition1).isTrue();
|
||||
boolean condition = factories.get(1) instanceof MyDummyFactory2;
|
||||
assertThat(condition).isTrue();
|
||||
assertThat(factories).hasSize(2);
|
||||
assertThat(factories.get(0)).isInstanceOf(MyDummyFactory1.class);
|
||||
assertThat(factories.get(1)).isInstanceOf(MyDummyFactory2.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
void loadPackagePrivateFactory() {
|
||||
List<DummyPackagePrivateFactory> factories =
|
||||
SpringFactoriesLoader.loadFactories(DummyPackagePrivateFactory.class, null);
|
||||
assertThat(factories.size()).isEqualTo(1);
|
||||
assertThat(factories).hasSize(1);
|
||||
assertThat(Modifier.isPublic(factories.get(0).getClass().getModifiers())).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
void attemptToLoadFactoryOfIncompatibleType() {
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
SpringFactoriesLoader.loadFactories(String.class, null))
|
||||
assertThatIllegalArgumentException()
|
||||
.isThrownBy(() -> SpringFactoriesLoader.loadFactories(String.class, null))
|
||||
.withMessageContaining("Unable to instantiate factory class "
|
||||
+ "[org.springframework.core.io.support.MyDummyFactory1] for factory type [java.lang.String]");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue