-
Notifications
You must be signed in to change notification settings - Fork 300
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move inner assertion classes out of
..testutil.Assertions
It is more consistent if all concrete assertion classes reside in `testutil.assertion`, instead of just some of them. Signed-off-by: Peter Gafert <peter.gafert@tngtech.com>
- Loading branch information
1 parent
1aa4028
commit 88e7ec5
Showing
10 changed files
with
343 additions
and
276 deletions.
There are no files selected for viewing
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
38 changes: 38 additions & 0 deletions
38
archunit/src/test/java/com/tngtech/archunit/testutil/assertion/AccessToFieldAssertion.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,38 @@ | ||
package com.tngtech.archunit.testutil.assertion; | ||
|
||
import com.tngtech.archunit.core.domain.AccessTarget; | ||
import com.tngtech.archunit.core.domain.JavaField; | ||
import com.tngtech.archunit.core.domain.JavaFieldAccess; | ||
import org.assertj.core.api.Condition; | ||
|
||
import static com.tngtech.archunit.core.domain.TestUtils.targetFrom; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
public class AccessToFieldAssertion extends BaseAccessAssertion<AccessToFieldAssertion, JavaFieldAccess, AccessTarget.FieldAccessTarget> { | ||
public AccessToFieldAssertion(JavaFieldAccess access) { | ||
super(access); | ||
} | ||
|
||
@Override | ||
protected AccessToFieldAssertion newAssertion(JavaFieldAccess access) { | ||
return new AccessToFieldAssertion(access); | ||
} | ||
|
||
public AccessToFieldAssertion isTo(final String name) { | ||
return isTo(new Condition<AccessTarget.FieldAccessTarget>("field with name '" + name + "'") { | ||
@Override | ||
public boolean matches(AccessTarget.FieldAccessTarget fieldAccessTarget) { | ||
return fieldAccessTarget.getName().equals(name); | ||
} | ||
}); | ||
} | ||
|
||
public AccessToFieldAssertion isTo(JavaField field) { | ||
return isTo(targetFrom(field)); | ||
} | ||
|
||
public AccessToFieldAssertion isOfType(JavaFieldAccess.AccessType type) { | ||
assertThat(access.getAccessType()).isEqualTo(type); | ||
return newAssertion(access); | ||
} | ||
} |
Oops, something went wrong.