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
10 changes: 10 additions & 0 deletions src/main/java/utils2/Math2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package utils2;

public class Math2 {

Integer summary(Integer n) {
if(n < 10) return 1;
if(n > 10 && n < 20) return 2;
return n;
}
}
17 changes: 17 additions & 0 deletions src/test/java/utils2/TC_1_Math2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package utils2;

import org.junit.Test;

import java.util.Optional;

import static junit.framework.TestCase.assertEquals;

public class TC_1_Math2 {

Check notice on line 9 in src/test/java/utils2/TC_1_Math2.java

View check run for this annotation

Codacy Development / Codacy Static Code Analysis

src/test/java/utils2/TC_1_Math2.java#L9

The class name 'TC_1_Math2' doesn't match '^Test.*$|^[A-Z][a-zA-Z0-9]*Test(s|Case)?$'

@Test
public void shouldSubtractIfMagicNumber() {
Math2 m = new Math2();
;
assertEquals(Optional.of(1), m.summary(5));
}
}