package com.levelup.java.string;

import static org.junit.Assert.assertEquals;

import org.apache.commons.lang3.StringUtils;
import org.junit.Test;

/**
 * This java example will demonstrate reversing a string
 * 
 * @author Justin Musgrove
 * @see <a href='http://www.leveluplunch.com/java/'></a>
 * 
 */
public class ReverseAString {

	private static final String PHRASE = "The dog barked at the mail man";
	private static final String PHRASE_REVERSE = "nam liam eht ta dekrab god ehT";
	
	@Test
	public void reverse_a_string_with_java () {
		
		StringBuffer buffer = new StringBuffer(PHRASE);
		
		String reversedString = buffer.reverse().toString();
	
		assertEquals(PHRASE_REVERSE, reversedString); 

	}
	
	@Test
	public void reverse_a_string_with_apache_commons () {
		
		String reversedString = StringUtils.reverse(PHRASE);
		
		assertEquals(PHRASE_REVERSE, reversedString);
		
	}
	
	
	
}

@@ -288,10 +288,48 @@
 ava/
-'%3E
+examples/reverse-string/'%3EReverse string
 %3C/a%3E
@@ -736,17 +736,16 @@
 ring); %0A
-%0A
 %09%7D%0A%09%0A%09@T
@@ -915,19 +915,13 @@
 ng);
-%0A%09
 %09%0A%09%7D%0A%09%0A
-%09%0A%09%0A
 %7D%0A

format add url