From 1c54558f34e1e82470e12e88f25fe92f88905338 Mon Sep 17 00:00:00 2001 From: dadgam3er Date: Sun, 8 Sep 2024 17:58:23 -0400 Subject: [PATCH] BismiALLAH --- .gitignore | 38 +++++++++++++++++++ .idea/.gitignore | 3 ++ .idea/encodings.xml | 7 ++++ .idea/misc.xml | 14 +++++++ .idea/vcs.xml | 6 +++ pom.xml | 31 +++++++++++++++ src/main/java/PrepSession/App.java | 13 +++++++ src/main/java/PrepSession/Attack.java | 5 +++ src/main/java/PrepSession/Breed.java | 10 +++++ src/main/java/PrepSession/Eagle.java | 16 ++++++++ src/main/java/PrepSession/Fish.java | 22 +++++++++++ src/main/java/PrepSession/Hide.java | 5 +++ src/main/java/PrepSession/MainClass.java | 23 +++++++++++ src/main/java/PrepSession/Rabbit.java | 17 +++++++++ src/test/java/PrepSession/AppTest.java | 38 +++++++++++++++++++ src/test/java/PrepSession/EagleTestCase.java | 20 ++++++++++ src/test/java/PrepSession/FishTestCase.java | 31 +++++++++++++++ src/test/java/PrepSession/RabbitTestCase.java | 19 ++++++++++ 18 files changed, 318 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/vcs.xml create mode 100644 pom.xml create mode 100644 src/main/java/PrepSession/App.java create mode 100644 src/main/java/PrepSession/Attack.java create mode 100644 src/main/java/PrepSession/Breed.java create mode 100644 src/main/java/PrepSession/Eagle.java create mode 100644 src/main/java/PrepSession/Fish.java create mode 100644 src/main/java/PrepSession/Hide.java create mode 100644 src/main/java/PrepSession/MainClass.java create mode 100644 src/main/java/PrepSession/Rabbit.java create mode 100644 src/test/java/PrepSession/AppTest.java create mode 100644 src/test/java/PrepSession/EagleTestCase.java create mode 100644 src/test/java/PrepSession/FishTestCase.java create mode 100644 src/test/java/PrepSession/RabbitTestCase.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..aa00ffa --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..82dbec8 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..b79a544 --- /dev/null +++ b/pom.xml @@ -0,0 +1,31 @@ + + 4.0.0 + + PrepSession + MvnDemo + 1.0-SNAPSHOT + jar + + MvnDemo + http://maven.apache.org + + + UTF-8 + + + + + junit + junit + 3.8.1 + test + + + junit + junit + 4.13.2 + test + + + diff --git a/src/main/java/PrepSession/App.java b/src/main/java/PrepSession/App.java new file mode 100644 index 0000000..9957678 --- /dev/null +++ b/src/main/java/PrepSession/App.java @@ -0,0 +1,13 @@ +package PrepSession; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/src/main/java/PrepSession/Attack.java b/src/main/java/PrepSession/Attack.java new file mode 100644 index 0000000..ebf02c0 --- /dev/null +++ b/src/main/java/PrepSession/Attack.java @@ -0,0 +1,5 @@ +package PrepSession; + +public interface Attack { + void Attacking(); +} diff --git a/src/main/java/PrepSession/Breed.java b/src/main/java/PrepSession/Breed.java new file mode 100644 index 0000000..56061fc --- /dev/null +++ b/src/main/java/PrepSession/Breed.java @@ -0,0 +1,10 @@ +package PrepSession; + +public abstract class Breed { + public abstract void Breeding(); + + public void Mating(){ + System.out.println("Male and Female has to mate"); + } + +} diff --git a/src/main/java/PrepSession/Eagle.java b/src/main/java/PrepSession/Eagle.java new file mode 100644 index 0000000..52730b2 --- /dev/null +++ b/src/main/java/PrepSession/Eagle.java @@ -0,0 +1,16 @@ +package PrepSession; + +public class Eagle extends Breed implements Attack{ + public static void main(String[] args) { + } + + @Override + public void Attacking() { + System.out.println("The Eagle is going crazy and I can't fucking find his prey."); + } + + @Override + public void Breeding() { + System.out.println("Breeding through laying eggs... Oviparous"); + } +} diff --git a/src/main/java/PrepSession/Fish.java b/src/main/java/PrepSession/Fish.java new file mode 100644 index 0000000..0dd4d1d --- /dev/null +++ b/src/main/java/PrepSession/Fish.java @@ -0,0 +1,22 @@ +package PrepSession; + +public class Fish extends Breed implements Hide, Attack{ + public static void main(String[] args) { + + } + + @Override + public void Hiding() { + System.out.println("The fish is going deeper to hide from the Eagle"); + } + + @Override + public void Attacking() { + System.out.println("The fish attacked a smaller fish"); + } + + @Override + public void Breeding() { + System.out.println("Breeding through laying eggs... Oviparous"); + } +} \ No newline at end of file diff --git a/src/main/java/PrepSession/Hide.java b/src/main/java/PrepSession/Hide.java new file mode 100644 index 0000000..cb3a625 --- /dev/null +++ b/src/main/java/PrepSession/Hide.java @@ -0,0 +1,5 @@ +package PrepSession; + +public interface Hide { + void Hiding(); +} diff --git a/src/main/java/PrepSession/MainClass.java b/src/main/java/PrepSession/MainClass.java new file mode 100644 index 0000000..98da750 --- /dev/null +++ b/src/main/java/PrepSession/MainClass.java @@ -0,0 +1,23 @@ +package PrepSession; + +public class MainClass { + public static void main(String[] args) { + + Fish fish = new Fish(); + fish.Hiding(); + fish.Attacking(); + fish.Breeding(); + System.out.println(""); + + Rabbit rabbit = new Rabbit(); + rabbit.Hiding(); + rabbit.Mating(); + rabbit.Breeding(); + System.out.println(""); + + Eagle hawk = new Eagle(); + hawk.Attacking(); + hawk.Mating(); + hawk.Breeding(); + } +} diff --git a/src/main/java/PrepSession/Rabbit.java b/src/main/java/PrepSession/Rabbit.java new file mode 100644 index 0000000..424a217 --- /dev/null +++ b/src/main/java/PrepSession/Rabbit.java @@ -0,0 +1,17 @@ +package PrepSession; + +public class Rabbit extends Breed implements Hide{ + public static void main(String[] args) { + + } + + @Override + public void Hiding() { + System.out.println("The Rabbit is running like crazy to hide."); + } + + @Override + public void Breeding() { + System.out.println("Breeding by having small baby rabbits... Mammals"); + } +} \ No newline at end of file diff --git a/src/test/java/PrepSession/AppTest.java b/src/test/java/PrepSession/AppTest.java new file mode 100644 index 0000000..b1f153e --- /dev/null +++ b/src/test/java/PrepSession/AppTest.java @@ -0,0 +1,38 @@ +package PrepSession; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} diff --git a/src/test/java/PrepSession/EagleTestCase.java b/src/test/java/PrepSession/EagleTestCase.java new file mode 100644 index 0000000..da49603 --- /dev/null +++ b/src/test/java/PrepSession/EagleTestCase.java @@ -0,0 +1,20 @@ +package PrepSession; + +import org.junit.Test; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import static org.junit.Assert.assertEquals; + +public class EagleTestCase { + @Test + public void Eagle_testATTACK(){ + Eagle hwak = new Eagle(); + + ByteArrayOutputStream eagAttack = new ByteArrayOutputStream(); + System.setOut(new PrintStream(eagAttack)); + hwak.Attacking(); + assertEquals("The Eagle is going crazy and I can't fucking find his prey.\n", eagAttack.toString()); + } +} diff --git a/src/test/java/PrepSession/FishTestCase.java b/src/test/java/PrepSession/FishTestCase.java new file mode 100644 index 0000000..7a69e0b --- /dev/null +++ b/src/test/java/PrepSession/FishTestCase.java @@ -0,0 +1,31 @@ +package PrepSession; + +import org.junit.Test; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import static org.junit.Assert.assertEquals; + +public class FishTestCase { + // Fish hides successfully + @Test + public void test_fish_hides_successfully() { + Fish fish = new Fish(); + // Assuming the output is checked via console output, we can use System.out to capture it. + // This is a simple example, in real scenarios, we might use a logging framework or mock the output. + ByteArrayOutputStream outContent = new ByteArrayOutputStream(); + System.setOut(new PrintStream(outContent)); + fish.Hiding(); + assertEquals("The fish is going deeper to hide from the Eagle\n", outContent.toString()); + } + + @Test + public void test_fishAttack(){ + Fish fish = new Fish(); + ByteArrayOutputStream attckOut = new ByteArrayOutputStream(); + System.setOut(new PrintStream(attckOut)); + fish.Attacking(); + assertEquals("The fish attacked a smaller fish\n", attckOut.toString()); + } +} diff --git a/src/test/java/PrepSession/RabbitTestCase.java b/src/test/java/PrepSession/RabbitTestCase.java new file mode 100644 index 0000000..cc9b0ec --- /dev/null +++ b/src/test/java/PrepSession/RabbitTestCase.java @@ -0,0 +1,19 @@ +package PrepSession; + +import org.junit.Test; + +import java.io.ByteArrayOutputStream; +import java.io.PrintStream; + +import static org.junit.Assert.assertEquals; + +public class RabbitTestCase { + @Test + public void Rabbit_TestCase(){ + Rabbit rabbit = new Rabbit(); + ByteArrayOutputStream outContent = new ByteArrayOutputStream(); + System.setOut(new PrintStream(outContent)); + rabbit.Hiding(); + assertEquals("The Rabbit is running like crazy to hide.\n", outContent.toString()); + } +}