package cat; public class kata{ public static int doubleValue(int x) { return x = x*2; } }
- package cat;
- public class kata{
- public static int doubleValue(int x) {
return x << 1;- return x = x*2;
- }
- }
import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; import cat.kata.*; // TODO: Replace examples and use TDD by writing your own tests // added some tests here as well, class SolutionTest { @Test void testSomething() { assertEquals(cat.kata.doubleValue(2), 4); assertEquals(cat.kata.doubleValue(3), 6); assertEquals(cat.kata.doubleValue(100), 200); assertEquals(cat.kata.doubleValue(628), 1256); assertEquals(cat.kata.doubleValue(-7), -14); } }
- import org.junit.jupiter.api.Test;
- import static org.junit.jupiter.api.Assertions.assertEquals;
- import cat.kata.*;
- // TODO: Replace examples and use TDD by writing your own tests
- // added some tests here as well,
- class SolutionTest {
- @Test
- void testSomething() {
- assertEquals(cat.kata.doubleValue(2), 4);
- assertEquals(cat.kata.doubleValue(3), 6);
- assertEquals(cat.kata.doubleValue(100), 200);
- assertEquals(cat.kata.doubleValue(628), 1256);
- assertEquals(cat.kata.doubleValue(-7), -14);
- }
- }