Commit facc5922 authored by Gerson Sunye's avatar Gerson Sunye
Browse files

.

parent eef4dde9
......@@ -15,4 +15,7 @@ dependencies {
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.7'
compile group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.2'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.0.3'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.0.3'
testCompile group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: '5.0.3'
}
......@@ -38,4 +38,9 @@ public class BookWithStates implements Book {
public Integer id() {
return null;
}
@Override
public String title() {
return null;
}
}
......@@ -50,4 +50,9 @@ public class SimpleBook implements Book {
public Integer id() {
return null;
}
@Override
public String title() {
return null;
}
}
package fr.unantes.time;
/**
* Created on 08/02/2018.
*
* @author sunye.
*/
public class Interval {
public class Interval<T extends Comparable> {
private final T begin;
private final T end;
protected Interval(T begin, T end) {
this.begin = begin;
this.end = end;
}
public boolean includes(T i) {
return i.compareTo(begin) >= 0 && i.compareTo(end) <= 0;
}
}
package fr.unantes.time;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;
import static org.junit.jupiter.api.Assertions.*;
/**
* Created on 08/02/2018.
*
* @author sunye.
*/
class IntervalTest {
private Interval<Integer> interval_1_10;
@BeforeEach
void setup() {
interval_1_10 = new Interval<>(0, 10);
}
@ParameterizedTest
@ValueSource(ints = {1, 5, 10})
void testIncludes(int value) {
assertTrue(interval_1_10.includes(value));
}
@ParameterizedTest
@ValueSource(ints = {Integer.MIN_VALUE, -1, 11, Integer.MAX_VALUE})
void testNotIncludes(int value) {
assertFalse(interval_1_10.includes(value));
}
}
\ No newline at end of file
group 'fr.unantes'
version '1.0-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'maven'
......
......@@ -16,6 +16,5 @@ public class CM {
List<Integer> integers = new ArrayList<>();
integers.stream().
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment