BismiALLAH
This commit is contained in:
commit
1c54558f34
38
.gitignore
vendored
Normal file
38
.gitignore
vendored
Normal file
@ -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
|
||||||
3
.idea/.gitignore
vendored
Normal file
3
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Default ignored files
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
7
.idea/encodings.xml
Normal file
7
.idea/encodings.xml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding">
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||||
|
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
14
.idea/misc.xml
Normal file
14
.idea/misc.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
|
<component name="MavenProjectsManager">
|
||||||
|
<option name="originalFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/pom.xml" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
|
</component>
|
||||||
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17" project-jdk-type="JavaSDK">
|
||||||
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="VcsDirectoryMappings">
|
||||||
|
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||||
|
</component>
|
||||||
|
</project>
|
||||||
31
pom.xml
Normal file
31
pom.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>PrepSession</groupId>
|
||||||
|
<artifactId>MvnDemo</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>MvnDemo</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.13.2</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
13
src/main/java/PrepSession/App.java
Normal file
13
src/main/java/PrepSession/App.java
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
package PrepSession;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hello world!
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class App
|
||||||
|
{
|
||||||
|
public static void main( String[] args )
|
||||||
|
{
|
||||||
|
System.out.println( "Hello World!" );
|
||||||
|
}
|
||||||
|
}
|
||||||
5
src/main/java/PrepSession/Attack.java
Normal file
5
src/main/java/PrepSession/Attack.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package PrepSession;
|
||||||
|
|
||||||
|
public interface Attack {
|
||||||
|
void Attacking();
|
||||||
|
}
|
||||||
10
src/main/java/PrepSession/Breed.java
Normal file
10
src/main/java/PrepSession/Breed.java
Normal file
@ -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");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
16
src/main/java/PrepSession/Eagle.java
Normal file
16
src/main/java/PrepSession/Eagle.java
Normal file
@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
22
src/main/java/PrepSession/Fish.java
Normal file
22
src/main/java/PrepSession/Fish.java
Normal file
@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
5
src/main/java/PrepSession/Hide.java
Normal file
5
src/main/java/PrepSession/Hide.java
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package PrepSession;
|
||||||
|
|
||||||
|
public interface Hide {
|
||||||
|
void Hiding();
|
||||||
|
}
|
||||||
23
src/main/java/PrepSession/MainClass.java
Normal file
23
src/main/java/PrepSession/MainClass.java
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
17
src/main/java/PrepSession/Rabbit.java
Normal file
17
src/main/java/PrepSession/Rabbit.java
Normal file
@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
38
src/test/java/PrepSession/AppTest.java
Normal file
38
src/test/java/PrepSession/AppTest.java
Normal file
@ -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 );
|
||||||
|
}
|
||||||
|
}
|
||||||
20
src/test/java/PrepSession/EagleTestCase.java
Normal file
20
src/test/java/PrepSession/EagleTestCase.java
Normal file
@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
31
src/test/java/PrepSession/FishTestCase.java
Normal file
31
src/test/java/PrepSession/FishTestCase.java
Normal file
@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
19
src/test/java/PrepSession/RabbitTestCase.java
Normal file
19
src/test/java/PrepSession/RabbitTestCase.java
Normal file
@ -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());
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user