public class BiggerNum { public static int compare(int a, int b) { return (a < b) ? b : a; } }
- public class BiggerNum
- {
- public static int compare(int a, int b)
- {
return Math.max(a, b);- return (a < b) ? b : a;
- }
- }
import org.junit.Test; import static org.junit.Assert.assertEquals; import org.junit.runners.JUnit4; // TODO: Replace examples and use TDD development by writing your own tests public class SolutionTest { @Test public void testSomething() { int a = 10; int b = 5; assertEquals(10, BiggerNum.compare(a, b)); } @Test public void anotherTest() { int firstNum = 1000; int secondNum = -200; assertEquals(1000, BiggerNum.compare(firstNum, secondNum)); } }
- import org.junit.Test;
- import static org.junit.Assert.assertEquals;
- import org.junit.runners.JUnit4;
- // TODO: Replace examples and use TDD development by writing your own tests
- public class SolutionTest {
- @Test
- public void testSomething() {
- int a = 10;
- int b = 5;
- assertEquals(10, BiggerNum.compare(a, b));
- }
- @Test
- public void anotherTest() {
- int firstNum = 1000;
- int secondNum = -200;
- assertEquals(1000, BiggerNum.compare(firstNum, secondNum));
- }
- }