diff --git a/EsimeneTest.java b/EsimeneTest.java new file mode 100644 index 0000000..f491000 --- /dev/null +++ b/EsimeneTest.java @@ -0,0 +1,24 @@ +package karolin; + +import org.junit.*; + +import static org.junit.Assert.*; + +public class EsimeneTest { + + Rakendus r = new Rakendus(); + + @Test + public void DayTest1() { + + assertEquals("Day is empty", r.dayCode("")); + assertEquals("Day is missing", r.dayCode(null)); + + } + + @Test + public void DayCodeInserted() { + + assertEquals("Enter a day", r.DayCodeInserted("Monday")); + } +} diff --git a/Rakendus.java b/Rakendus.java new file mode 100644 index 0000000..98c1745 --- /dev/null +++ b/Rakendus.java @@ -0,0 +1,55 @@ +package karolin; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +public class Rakendus { + + + String dayCode(String code) { + if (code == null) { + code = "Day is missing"; + + } else if (code.equals("")) { + code = "Day is empty"; + } + return code; + } + + String DayCodeInserted(String code) { + String temp = code.substring(0); + + if (temp.equals("Monday") || temp.equals("Tuesday") || temp.equals("Wednesday") || temp.equals("Thursday") || temp.equals("Friday") || temp.equals("Saturday") || temp.equals("Sunday")) { + code = "Enter a day"; + + } + return code; + } + + public static void main(String[] args) { + Rakendus r = new Rakendus(); + } +} + +//scl enable rh-maven33 bash +//mvn package +//java -jar target/boot3-1.0-SNAPSHOT.jar +/*------------------------------------------------------- + T E S T S +------------------------------------------------------- +Running karolin.EsimeneTest +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec - in karolin.EsimeneTest + +Results : + +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0 + +[INFO] ------------------------------------------------------------------------ +[INFO] BUILD SUCCESS +[INFO] ------------------------------------------------------------------------ +[INFO] Total time: 1.535 s +[INFO] Finished at: 2017-05-17T12:49:57+03:00 +[INFO] Final Memory: 16M/225M +[INFO] ----------------------------------*/ \ No newline at end of file diff --git a/TEST-karolin.EsimeneTest.xml b/TEST-karolin.EsimeneTest.xml new file mode 100644 index 0000000..592d5a0 --- /dev/null +++ b/TEST-karolin.EsimeneTest.xml @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/karolin.EsimeneTest.txt b/karolin.EsimeneTest.txt new file mode 100644 index 0000000..15bd9ff --- /dev/null +++ b/karolin.EsimeneTest.txt @@ -0,0 +1,4 @@ +------------------------------------------------------------------------------- +Test set: karolin.EsimeneTest +------------------------------------------------------------------------------- +Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.003 sec - in karolin.EsimeneTest diff --git a/pom.properties b/pom.properties new file mode 100644 index 0000000..a5bbd7b --- /dev/null +++ b/pom.properties @@ -0,0 +1,5 @@ +#Generated by Maven +#Wed May 17 12:49:28 EEST 2017 +version=1 +groupId=karolin +artifactId=rakendus diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..bb073c4 --- /dev/null +++ b/pom.xml @@ -0,0 +1,34 @@ + + + 4.0.0 + karolin + rakendus + jar + 1 + + + org.springframework.boot + spring-boot-starter-parent + 1.3.6.RELEASE + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-test + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + +