-
-
Notifications
You must be signed in to change notification settings - Fork 683
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add baseline for ClassLoader assertions
- Loading branch information
Showing
16 changed files
with
250 additions
and
0 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
assertj-core/src/main/java/org/assertj/core/api/AbstractClassLoaderAssert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* Copyright 2012-2023 the original author or authors. | ||
*/ | ||
package org.assertj.core.api; | ||
|
||
/** | ||
* Base class for all implementations of assertions for {@link ClassLoader class loaders}. | ||
* | ||
* @param <SELF> the "self" type of this assertion class. Please read "<a | ||
* href="http://bit.ly/1IZIRcY" target="_blank">Emulating 'self types' using Java | ||
* Generics to simplify fluent API implementation</a>" for more details. | ||
* @author Ashley Scopes | ||
* @since 3.24.0 | ||
*/ | ||
public abstract class AbstractClassLoaderAssert<SELF extends AbstractClassLoaderAssert<SELF>> | ||
extends AbstractAssert<SELF, ClassLoader> { | ||
|
||
protected AbstractClassLoaderAssert(ClassLoader classLoader, Class<?> selfType) { | ||
super(classLoader, selfType); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
assertj-core/src/main/java/org/assertj/core/api/ClassLoaderAssert.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* Copyright 2012-2023 the original author or authors. | ||
*/ | ||
package org.assertj.core.api; | ||
|
||
/** | ||
* Assertion methods for {@link ClassLoader class loaders}. | ||
* <p> | ||
* To create a new instance of this class, invoke | ||
* <code>{@link Assertions#assertThat(ClassLoader)}</code></p> | ||
* | ||
* @author Ashley Scopes | ||
* @since 3.24.0 | ||
*/ | ||
public class ClassLoaderAssert extends AbstractClassLoaderAssert<ClassLoaderAssert> { | ||
|
||
/** | ||
* Initialize this assertion. | ||
* | ||
* @param actual the classloader to perform assertions upon. | ||
*/ | ||
protected ClassLoaderAssert(ClassLoader actual) { | ||
super(actual, ClassLoaderAssert.class); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...-core/src/test/java/org/assertj/core/api/Assertions_assertThat_with_ClassLoader_Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* Copyright 2012-2023 the original author or authors. | ||
*/ | ||
package org.assertj.core.api; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.assertj.core.api.BDDAssertions.then; | ||
import static org.mockito.Mockito.mock; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
/** | ||
* @author Ashley Scopes | ||
*/ | ||
class Assertions_assertThat_with_ClassLoader_Test { | ||
|
||
private final ClassLoader actual = mock(ClassLoader.class); | ||
|
||
@Test | ||
void should_create_Assert() { | ||
// WHEN | ||
AbstractClassLoaderAssert<?> assertions = assertThat(actual); | ||
// THEN | ||
then(assertions).isNotNull(); | ||
} | ||
|
||
@Test | ||
void should_pass_actual() { | ||
// WHEN | ||
AbstractClassLoaderAssert<?> assertions = assertThat(actual); | ||
// THEN | ||
then(assertions).extracting("actual").isSameAs(actual); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters