forked from youngnh/RockPaperScissors
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rock beats scissors
- Loading branch information
Showing
7 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<project name="RockPaperScissors" default="dist" basedir="."> | ||
<property name="src" location="src" /> | ||
<property name="test" location="test" /> | ||
<property name="lib" location="lib" /> | ||
<property name="build" location="build" /> | ||
<property name="dist" location="dist" /> | ||
<property name="classes" location="${build}/classes" /> | ||
<property name="test.classes" location="${build}/test-classes" /> | ||
<property name="test.report" location="${build}/reports" /> | ||
|
||
<target name="init"> | ||
<tstamp /> | ||
<mkdir dir="${classes}" /> | ||
<mkdir dir="${test.classes}" /> | ||
<mkdir dir="${test.report}" /> | ||
<mkdir dir="${dist}" /> | ||
</target> | ||
|
||
<path id="class.path"> | ||
<pathelement location="${classes}" /> | ||
<pathelement location="${test.classes}" /> | ||
<fileset dir="${lib}"> | ||
<include name="*.jar" /> | ||
</fileset> | ||
</path> | ||
|
||
<target name="compile" depends="init"> | ||
<javac destdir="${classes}" debug="on"> | ||
<src> | ||
<pathelement location="${src}" /> | ||
</src> | ||
<classpath refid="class.path" /> | ||
</javac> | ||
<javac destdir="${test.classes}" debug="on"> | ||
<src> | ||
<pathelement location="${test}" /> | ||
</src> | ||
<classpath refid="class.path" /> | ||
</javac> | ||
</target> | ||
|
||
<target name="test" depends="compile"> | ||
<junit printsummary="on" haltonerror="true" haltonfailure="true"> | ||
<classpath refid="class.path" /> | ||
<batchtest todir="${test.report}"> | ||
<formatter type="plain" /> | ||
<fileset dir="${test}"> | ||
<include name="**/*Test.java"/> | ||
</fileset> | ||
</batchtest> | ||
</junit> | ||
</target> | ||
|
||
<target name="dist" depends="test"> | ||
<jar destfile="${dist}/${ant.project.name}-${DSTAMP}.jar" basedir="${classes}"/> | ||
</target> | ||
|
||
<target name="clean"> | ||
<delete dir="${build}" /> | ||
</target> | ||
</project> |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.twoguys.rps; | ||
|
||
public class Rock extends Throw { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.twoguys.rps; | ||
|
||
public class Scissors extends Throw { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.twoguys.rps; | ||
|
||
public abstract class Throw { | ||
|
||
public boolean beats(Throw other) { | ||
return true; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.twoguys.rps; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
import org.junit.Test; | ||
|
||
public class ThrowTest { | ||
|
||
@Test | ||
public void testRockBeatsScissors() { | ||
Throw rock = new Rock(); | ||
Throw scissors = new Scissors(); | ||
boolean result = rock.beats(scissors); | ||
assertTrue(result); | ||
} | ||
} |