Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.codility.tasks.invert;
- import com.codility.tasks.invert.Inverter;
- import org.junit.Assert;
- import static org.junit.Assert.*;
- import org.junit.Test;
- public class InverterTest {
- @Test
- public void invertNullShouldReturnEmptyString() {
- /// Arrange
- String expectedValue = "";
- String passedValue = null;
- /// Act
- String result = Inverter.invert(passedValue);
- /// Assert
- assertEquals(expectedValue, result);
- }
- @Test
- public void invertEmptyShouldReturnEmptyString() {
- /// Arrange
- String expectedValue = "";
- String passedValue = "";
- /// Act
- String result = Inverter.invert(passedValue);
- /// Assert
- assertEquals(expectedValue, result);
- }
- @Test
- public void invertOneLetterStringShouldReturnThisSameObject() {
- /// Arrange
- String passedValue = "a";
- /// Act
- String result = Inverter.invert(passedValue);
- /// Assert
- assertSame(result, passedValue);
- }
- @Test
- public void invertCBAShouldReturnABC() {
- /// Arrange
- String passedValue = "CBA";
- String expectedValue = "ABC";
- /// Act
- String result = Inverter.invert(passedValue);
- /// Assert
- assertEquals(result, expectedValue);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement