BAEL-3184 (#7505)
- Moved operator related modules from core-java-lang-syntax to core-java-lang-operators
This commit is contained in:
parent
c8e517f6e8
commit
f767e462f5
|
@ -1,63 +0,0 @@
|
||||||
package com.baeldung.incrementdecrementunaryoperator;
|
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class IncrementDecrementUnaryOperatorUnitTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenAnOperand_whenUsingPreIncrementUnaryOperator_thenOperandIsIncrementedByOne() {
|
|
||||||
int operand = 1;
|
|
||||||
++operand;
|
|
||||||
assertThat(operand).isEqualTo(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenANumber_whenUsingPreIncrementUnaryOperatorInEvaluation_thenNumberIsIncrementedByOne() {
|
|
||||||
int operand = 1;
|
|
||||||
int number = ++operand;
|
|
||||||
assertThat(number).isEqualTo(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenAnOperand_whenUsingPreDecrementUnaryOperator_thenOperandIsDecrementedByOne() {
|
|
||||||
int operand = 1;
|
|
||||||
--operand;
|
|
||||||
assertThat(operand).isEqualTo(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenANumber_whenUsingPreDecrementUnaryOperatorInEvaluation_thenNumberIsDecrementedByOne() {
|
|
||||||
int operand = 1;
|
|
||||||
int number = --operand;
|
|
||||||
assertThat(number).isEqualTo(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenAnOperand_whenUsingPostIncrementUnaryOperator_thenOperandIsIncrementedByOne() {
|
|
||||||
int operand = 1;
|
|
||||||
operand++;
|
|
||||||
assertThat(operand).isEqualTo(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenANumber_whenUsingPostIncrementUnaryOperatorInEvaluation_thenNumberIsSameAsOldValue() {
|
|
||||||
int operand = 1;
|
|
||||||
int number = operand++;
|
|
||||||
assertThat(number).isEqualTo(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenAnOperand_whenUsingPostDecrementUnaryOperator_thenOperandIsDecrementedByOne() {
|
|
||||||
int operand = 1;
|
|
||||||
operand--;
|
|
||||||
assertThat(operand).isEqualTo(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void givenANumber_whenUsingPostDecrementUnaryOperatorInEvaluation_thenNumberIsSameAsOldValue() {
|
|
||||||
int operand = 1;
|
|
||||||
int number = operand--;
|
|
||||||
assertThat(number).isEqualTo(1);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue