diff --git a/code-manipulation/pom.xml b/code-manipulation/pom.xml new file mode 100644 index 00000000..5425ee48 --- /dev/null +++ b/code-manipulation/pom.xml @@ -0,0 +1,75 @@ + + + + 4.0.0 + + org.example + code-manipulation + 1.0-SNAPSHOT + + code-manipulation + + http://www.example.com + + + UTF-8 + 11 + 11 + + + + + junit + junit + 4.11 + test + + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.4 + + + + prepare-agent + + + + report + prepare-package + + report + + + + jacoco-check + + check + + + + + PACKAGE + + + LINE + COVEREDRATIO + 0.50 + + + + + + + + + + + + diff --git a/code-manipulation/src/main/java/org/example/Moim.java b/code-manipulation/src/main/java/org/example/Moim.java new file mode 100644 index 00000000..5d81801a --- /dev/null +++ b/code-manipulation/src/main/java/org/example/Moim.java @@ -0,0 +1,20 @@ +package org.example; + +public class Moim { + + int maxNumberOfAttendees; + + int numberOfEnrollment; + + public boolean isEnrollmentFull() { + if (maxNumberOfAttendees == 0) { + return false; + } + + if (numberOfEnrollment < maxNumberOfAttendees) { + return false; + } + + return true; + } +} diff --git a/code-manipulation/src/test/java/org/example/AppTest.java b/code-manipulation/src/test/java/org/example/AppTest.java new file mode 100644 index 00000000..02be65f7 --- /dev/null +++ b/code-manipulation/src/test/java/org/example/AppTest.java @@ -0,0 +1,19 @@ +package org.example; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +/** + * Unit test for simple App. + */ +public class AppTest { + /** + * Rigorous Test :-) + */ + @Test + public void shouldAnswerWithTrue() + { + assertTrue( true ); + } +} diff --git a/code-manipulation/src/test/java/org/example/MoimTest.java b/code-manipulation/src/test/java/org/example/MoimTest.java new file mode 100644 index 00000000..b382e5e0 --- /dev/null +++ b/code-manipulation/src/test/java/org/example/MoimTest.java @@ -0,0 +1,15 @@ +package org.example; + +import org.junit.Assert; +import org.junit.Test; + +public class MoimTest { + + @Test + public void isFull() throws Exception { + Moim moim = new Moim(); + moim.maxNumberOfAttendees = 100; + moim.numberOfEnrollment = 10; + Assert.assertFalse(moim.isEnrollmentFull()); + } +} \ No newline at end of file