Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/palindrom/palindrom.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import java.io.EOFException;
import java.util.Scanner;

/* This is my new palindrome program*/
public class palindrom {
public boolean isPal(int a){
int b,c, e;
Expand Down Expand Up @@ -89,7 +90,7 @@ public static void main(String[] args) {
{
if(obj.isPal(mas[i]))
{
System.out.print(mas[i] + " ");
System.out.print(mas[i] + " It is palindrome");
}
}
scanner.close();
Expand Down
11 changes: 11 additions & 0 deletions untest/palindrom/AllTests.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package palindrom;

import org.junit.runner.RunWith;
import org.junit.runners.Suite;
import org.junit.runners.Suite.SuiteClasses;

@RunWith(Suite.class)
@SuiteClasses({ PalindromeTest1.class, palindromTest.class })
public class AllTests {

}
52 changes: 52 additions & 0 deletions untest/palindrom/PalindromeTest1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package palindrom;

import static org.junit.Assert.*;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

public class PalindromeTest1 {

@BeforeClass
public static void setUpBeforeClass() throws Exception {
System.out.println("Test setup for test suite");
}

@AfterClass
public static void tearDownAfterClass() throws Exception {
System.out.println("test cleanup after all the tests have executed");
}

@Before
public void setUp() throws Exception {
System.out.println("Test setup after each test case");
}

@After
public void tearDown() throws Exception {
System.out.println("Test clean up after each test");
}

@Test
public void isPalindromPositive() {
palindrom test = new palindrom();
assertTrue(test.isPal(12321));
}

@Test
public void isPalindromeNegative() {
palindrom test = new palindrom();
assertFalse(test.isPal(1234));
}

@Test
public void runExistingTestCase()
{
palindromTest palindromTest = new palindromTest();
palindromTest.testIsPal();
}

}