-
-
Notifications
You must be signed in to change notification settings - Fork 682
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Increase IntegerAssert test coverage to 100%
- Loading branch information
1 parent
8fa8010
commit f84ad2e
Showing
5 changed files
with
187 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/test/java/org/assertj/core/api/integer_/IntegerAssert_isCloseToPercentage_int_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,36 @@ | ||
/* | ||
* 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-2022 the original author or authors. | ||
*/ | ||
package org.assertj.core.api.integer_; | ||
|
||
import org.assertj.core.api.IntegerAssert; | ||
import org.assertj.core.api.IntegerAssertBaseTest; | ||
import org.assertj.core.data.Percentage; | ||
|
||
import static org.assertj.core.data.Percentage.withPercentage; | ||
import static org.mockito.Mockito.verify; | ||
|
||
class IntegerAssert_isCloseToPercentage_int_Test extends IntegerAssertBaseTest { | ||
|
||
private final Percentage percentage = withPercentage(3); | ||
private final int value = 42; | ||
|
||
@Override | ||
protected IntegerAssert invoke_api_method() { | ||
return assertions.isCloseTo(value, percentage); | ||
} | ||
|
||
@Override | ||
protected void verify_internal_effects() { | ||
verify(integers).assertIsCloseToPercentage(getInfo(assertions), getActual(assertions), value, percentage); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/test/java/org/assertj/core/api/integer_/IntegerAssert_isCloseTo_int_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,36 @@ | ||
/* | ||
* 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-2022 the original author or authors. | ||
*/ | ||
package org.assertj.core.api.integer_; | ||
|
||
import org.assertj.core.api.IntegerAssert; | ||
import org.assertj.core.api.IntegerAssertBaseTest; | ||
import org.assertj.core.data.Offset; | ||
|
||
import static org.assertj.core.data.Offset.offset; | ||
import static org.mockito.Mockito.verify; | ||
|
||
class IntegerAssert_isCloseTo_int_Test extends IntegerAssertBaseTest { | ||
|
||
private final Offset<Integer> offset = offset(13); | ||
private final int value = 7; | ||
|
||
@Override | ||
protected IntegerAssert invoke_api_method() { | ||
return assertions.isCloseTo(value, offset); | ||
} | ||
|
||
@Override | ||
protected void verify_internal_effects() { | ||
verify(integers).assertIsCloseTo(getInfo(assertions), getActual(assertions), value, offset); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...est/java/org/assertj/core/api/integer_/IntegerAssert_isEqualTo_noncastable_long_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,33 @@ | ||
/* | ||
* 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-2022 the original author or authors. | ||
*/ | ||
package org.assertj.core.api.integer_; | ||
|
||
import org.assertj.core.api.IntegerAssert; | ||
import org.assertj.core.api.IntegerAssertBaseTest; | ||
|
||
import static org.mockito.Mockito.verify; | ||
|
||
class IntegerAssert_isEqualTo_large_long_Test extends IntegerAssertBaseTest { | ||
|
||
private final long expected = ((long) Integer.MAX_VALUE) + 2L; | ||
|
||
@Override | ||
protected IntegerAssert invoke_api_method() { | ||
return assertions.isEqualTo(expected); | ||
} | ||
|
||
@Override | ||
protected void verify_internal_effects() { | ||
verify(integers).assertEqual(getInfo(assertions), getActual(assertions), expected); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...est/java/org/assertj/core/api/integer_/IntegerAssert_isNotCloseToPercentage_int_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,41 @@ | ||
/* | ||
* 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-2022 the original author or authors. | ||
*/ | ||
package org.assertj.core.api.integer_; | ||
|
||
import org.assertj.core.api.IntegerAssert; | ||
import org.assertj.core.api.IntegerAssertBaseTest; | ||
import org.assertj.core.data.Percentage; | ||
|
||
import static org.assertj.core.data.Percentage.withPercentage; | ||
import static org.mockito.Mockito.verify; | ||
|
||
/** | ||
* Tests for <code>{@link IntegerAssert#isNotCloseTo(Integer, Percentage)}</code>. | ||
* | ||
* @author Chris Arnott | ||
*/ | ||
class IntegerAssert_isNotCloseToPercentage_int_Test extends IntegerAssertBaseTest { | ||
|
||
private final Percentage percentage = withPercentage(3); | ||
private final int value = 42; | ||
|
||
@Override | ||
protected IntegerAssert invoke_api_method() { | ||
return assertions.isNotCloseTo(value, percentage); | ||
} | ||
|
||
@Override | ||
protected void verify_internal_effects() { | ||
verify(integers).assertIsNotCloseToPercentage(getInfo(assertions), getActual(assertions), value, percentage); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/test/java/org/assertj/core/api/integer_/IntegerAssert_isNotCloseTo_int_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,41 @@ | ||
/* | ||
* 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-2022 the original author or authors. | ||
*/ | ||
package org.assertj.core.api.integer_; | ||
|
||
import org.assertj.core.api.IntegerAssert; | ||
import org.assertj.core.api.IntegerAssertBaseTest; | ||
import org.assertj.core.data.Offset; | ||
|
||
import static org.assertj.core.data.Offset.offset; | ||
import static org.mockito.Mockito.verify; | ||
|
||
/** | ||
* Tests for <code>{@link IntegerAssert#isNotCloseTo(Integer, Offset)}</code>. | ||
* | ||
* @author Chris Arnott | ||
*/ | ||
class IntegerAssert_isNotCloseTo_int_Test extends IntegerAssertBaseTest { | ||
|
||
private final Offset<Integer> offset = offset(13); | ||
private final int value = 7; | ||
|
||
@Override | ||
protected IntegerAssert invoke_api_method() { | ||
return assertions.isNotCloseTo(value, offset); | ||
} | ||
|
||
@Override | ||
protected void verify_internal_effects() { | ||
verify(integers).assertIsNotCloseTo(getInfo(assertions), getActual(assertions), value, offset); | ||
} | ||
} |