package net.dvt32.exceptions.task1;

import static org.junit.Assert.*;

import org.junit.Test;

public class SumatorTest {

	Sumator s = new Sumator();
	
	/*
	 * getSumOfNumbers() tests
	 */
	@Test
	public void shouldReturn12345() {
		String expectedOutput = "12345";
		String actualOutput = s.getSumOfNumbers("12339", "6");
		assertEquals(expectedOutput, actualOutput);
	}

	@Test(expected = NumberFormatException.class)
	public void shouldThrowNumberFormatExceptionWithAppropriateMessage() {
		s.getSumOfNumbers("12339", "-6");
	}
	
	@Test
	public void shouldReturn0() {
		String expectedOutput = "0";
		String actualOutput = s.getSumOfNumbers("00000000000000000000000000", "00000000000000000");
		assertEquals(expectedOutput, actualOutput);
	}
	
	@Test(expected = IllegalArgumentException.class)
	public void shouldThrowIllegalArgumentExceptionWithNoEmptyNumbersAllowedMessage() {
		String expectedOutput = "123";
		String actualOutput = s.getSumOfNumbers("", "123");
		assertEquals(expectedOutput, actualOutput);
	}
	
	/*
	 * getStringWithoutLeadingZeros() tests
	 */
	@Test
	public void shouldntReturnBlankString() {
		String output = s.getStringWithoutLeadingZeros("0");
		assertTrue( output.length() != 0 );
	}
	
	@Test(expected = NullPointerException.class) 
	public void shouldThrowNullPointerException() {
		s.getStringWithoutLeadingZeros(null);
	}

	/*
	 * checkIfNumberIsValid() tests
	 */
	@Test(expected = NullPointerException.class)
	public void shouldNullPointerExceptionWithMessage() {
		s.checkIfNumberIsValid(null);
	}
	
	@Test(expected = IllegalArgumentException.class)
	public void shouldThrowIllegalArgumentException() {
		s.checkIfNumberIsValid("");
	}
	
	@Test(expected = NumberFormatException.class)
	public void shouldThrowNumberFormatException_FirstTest() {
		s.checkIfNumberIsValid("1.0");
	}
	
	@Test(expected = NumberFormatException.class)
	public void shouldThrowNumberFormatException_SecondTest() {
		s.checkIfNumberIsValid("-1");
	}
	
	@Test(expected = NumberFormatException.class)
	public void shouldThrowNumberFormatException_ThirdTest() {
		s.checkIfNumberIsValid("1 ");
	}
}
@@ -2183,9 +2183,103 @@
 );%0D%0A%09%7D%0D%0A
-%7D
+%09%0D%0A%09@Test%0D%0A%09public void shouldNotThrowAnyException() %7B%0D%0A%09%09s.checkIfNumberIsValid(%221%22);%0D%0A%09%7D%0D%0A%7D%0D%0A

Add one more test to SumatorTest class