-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#18] Enhanced some unit tests for Operands
- Loading branch information
1 parent
59b4a76
commit 2874365
Showing
4 changed files
with
91 additions
and
4 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
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
65 changes: 65 additions & 0 deletions
65
...ionprocessortoolkit/templating/expressions/operands/UnaryOperationWrapperOperandTest.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,65 @@ | ||
package io.toolisticon.annotationprocessortoolkit.templating.expressions.operands; | ||
|
||
import io.toolisticon.annotationprocessortoolkit.templating.expressions.operations.OperationType; | ||
import org.hamcrest.MatcherAssert; | ||
import org.hamcrest.Matchers; | ||
import org.junit.Test; | ||
|
||
/** | ||
* Unit test for {@link UnaryOperationWrapperOperand}. | ||
*/ | ||
public class UnaryOperationWrapperOperandTest { | ||
|
||
@Test(expected = IllegalArgumentException.class) | ||
public void test_nullValuedOperationType_mustThrowException() { | ||
|
||
new UnaryOperationWrapperOperand(new BooleanOperand("true"), null); | ||
|
||
} | ||
|
||
@Test(expected = IllegalArgumentException.class) | ||
public void test_binaryOperationType_mustThrowException() { | ||
|
||
new UnaryOperationWrapperOperand(new BooleanOperand("true"), OperationType.DIVISION); | ||
|
||
} | ||
|
||
@Test | ||
public void test_unaryOperationType_mustNotThrowException() { | ||
|
||
new UnaryOperationWrapperOperand(new BooleanOperand("true"), OperationType.NEGATE); | ||
|
||
} | ||
|
||
@Test | ||
public void test_unaryOperationType_successfulPath_getValue() { | ||
|
||
UnaryOperationWrapperOperand unit = new UnaryOperationWrapperOperand(new BooleanOperand("true"), OperationType.NEGATE); | ||
MatcherAssert.assertThat((Boolean) unit.value(), Matchers.is(false)); | ||
|
||
unit = new UnaryOperationWrapperOperand(new BooleanOperand("false"), OperationType.NEGATE); | ||
MatcherAssert.assertThat((Boolean) unit.value(), Matchers.is(true)); | ||
|
||
|
||
} | ||
|
||
@Test | ||
public void test_unaryOperationType_successfulPath_getOperandsJavaType() { | ||
|
||
UnaryOperationWrapperOperand unit = new UnaryOperationWrapperOperand(new BooleanOperand("true"), OperationType.NEGATE); | ||
MatcherAssert.assertThat( (Class)unit.getOperandsJavaType(), Matchers.equalTo((Class)Boolean.class)); | ||
|
||
|
||
|
||
} | ||
|
||
@Test(expected = IllegalArgumentException.class) | ||
public void test_nullValuedOperand_mustThrowException() { | ||
|
||
UnaryOperationWrapperOperand unit = new UnaryOperationWrapperOperand(null, OperationType.NEGATE); | ||
MatcherAssert.assertThat(unit.value(), Matchers.nullValue()); | ||
|
||
|
||
} | ||
|
||
} |