Advertisement
Guest User

Untitled

a guest
Sep 21st, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.39 KB | None | 0 0
  1. package com.codility.tasks.invert;
  2.  
  3. import com.codility.tasks.invert.Inverter;
  4. import org.junit.Assert;
  5. import static org.junit.Assert.*;
  6. import org.junit.Test;
  7.  
  8. public class InverterTest {
  9.    
  10.     @Test
  11.     public void invertNullShouldReturnEmptyString() {
  12.         /// Arrange
  13.         String expectedValue = "";
  14.         String passedValue = null;
  15.  
  16.         /// Act
  17.         String result = Inverter.invert(passedValue);
  18.  
  19.         /// Assert
  20.         assertEquals(expectedValue, result);
  21.     }
  22.  
  23.     @Test
  24.     public void invertEmptyShouldReturnEmptyString() {
  25.         /// Arrange
  26.         String expectedValue = "";
  27.         String passedValue = "";
  28.  
  29.         /// Act
  30.         String result = Inverter.invert(passedValue);
  31.  
  32.         /// Assert
  33.         assertEquals(expectedValue, result);
  34.     }
  35.  
  36.     @Test
  37.     public void invertOneLetterStringShouldReturnThisSameObject() {
  38.         /// Arrange
  39.         String passedValue = "a";
  40.  
  41.         /// Act
  42.         String result = Inverter.invert(passedValue);
  43.  
  44.         /// Assert
  45.         assertSame(result, passedValue);
  46.     }
  47.  
  48.  
  49.     @Test
  50.     public void invertCBAShouldReturnABC() {
  51.         /// Arrange
  52.         String passedValue = "CBA";
  53.         String expectedValue = "ABC";
  54.  
  55.         /// Act
  56.         String result = Inverter.invert(passedValue);
  57.  
  58.         /// Assert
  59.         assertEquals(result, expectedValue);
  60.     }
  61.  
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement