Skip to content

Commit

Permalink
renamed project testanza->quackery
Browse files Browse the repository at this point in the history
  • Loading branch information
maciejmikosik committed Mar 14, 2015
1 parent 2352c45 commit 10bc851
Show file tree
Hide file tree
Showing 30 changed files with 222 additions and 187 deletions.
2 changes: 1 addition & 1 deletion .project
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<projectDescription> <projectDescription>
<name>testanza</name> <name>quackery</name>
<comment></comment> <comment></comment>
<projects> <projects>
</projects> </projects>
Expand Down
10 changes: 5 additions & 5 deletions main/build/build.sh
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ javac \
-source 1.7 \ -source 1.7 \
-target 1.7 \ -target 1.7 \
-d "./sink/building" \ -d "./sink/building" \
./java/org/testanza/Build.java ./java/org/quackery/Build.java


#copy sources #copy sources
cp \ cp \
Expand All @@ -33,18 +33,18 @@ cd ./sink/building
zip \ zip \
--quiet \ --quiet \
--recurse-paths \ --recurse-paths \
./testanza.jar \ ./quackery.jar \
./* ./*
cd $MAIN cd $MAIN


#copy testanza.jar #copy quackery.jar
cp \ cp \
./sink/building/testanza.jar \ ./sink/building/quackery.jar \
./sink ./sink


echo "" echo ""
echo "BUILD SUCCESSFUL" echo "BUILD SUCCESSFUL"
echo "created $MAIN/sink/testanza.jar" echo "created $MAIN/sink/quackery.jar"


#cleanup #cleanup
rm \ rm \
Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.testanza; package org.quackery;


import static java.util.Arrays.asList; import static java.util.Arrays.asList;


Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.testanza; package org.quackery;


import static org.testanza.TestanzaException.check; import static org.quackery.QuackeryException.check;


public abstract class Case implements Test { public abstract class Case implements Test {
public final String name; public final String name;
Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.testanza; package org.quackery;


import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.Map; import java.util.Map;
Expand Down Expand Up @@ -29,9 +29,9 @@ private static TestCase junit(final Case cas) {
protected void runTest() throws Throwable { protected void runTest() throws Throwable {
try { try {
cas.run(); cas.run();
} catch (TestanzaAssertionException e) { } catch (QuackeryAssertionException e) {
throw new AssertionError(e.getMessage(), e); throw new AssertionError(e.getMessage(), e);
} catch (TestanzaAssumptionException e) { } catch (QuackeryAssumptionException e) {
throw newAssumptionException(e); throw newAssumptionException(e);
} }
} }
Expand All @@ -44,7 +44,7 @@ protected void runTest() throws Throwable {
*/ */
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
private static AssumptionViolatedException newAssumptionException( private static AssumptionViolatedException newAssumptionException(
TestanzaAssumptionException exception) { QuackeryAssumptionException exception) {
AssumptionViolatedException wrap = new AssumptionViolatedException(exception.getMessage()); AssumptionViolatedException wrap = new AssumptionViolatedException(exception.getMessage());
wrap.initCause(exception); wrap.initCause(exception);
return wrap; return wrap;
Expand Down
13 changes: 13 additions & 0 deletions main/java/org/quackery/QuackeryAssertionException.java
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.quackery;

public class QuackeryAssertionException extends RuntimeException {
public QuackeryAssertionException() {}

public QuackeryAssertionException(String message) {
super(message);
}

public QuackeryAssertionException(String message, Throwable cause) {
super(message, cause);
}
}
28 changes: 28 additions & 0 deletions main/java/org/quackery/QuackeryAssumptionException.java
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.quackery;

public class QuackeryAssumptionException extends RuntimeException {
public QuackeryAssumptionException() {}

public QuackeryAssumptionException(String message, Throwable cause, boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}

public QuackeryAssumptionException(String message, Throwable cause) {
super(message, cause);
}

public QuackeryAssumptionException(String message) {
super(message);
}

public QuackeryAssumptionException(Throwable cause) {
super(cause);
}

public static void check(boolean condition) {
if (!condition) {
throw new QuackeryAssumptionException();
}
}
}
23 changes: 23 additions & 0 deletions main/java/org/quackery/QuackeryException.java
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.quackery;

public class QuackeryException extends RuntimeException {
public QuackeryException() {}

public QuackeryException(String message) {
super(message);
}

public QuackeryException(Throwable cause) {
super(cause);
}

public QuackeryException(String message, Throwable cause) {
super(message, cause);
}

public static void check(boolean condition) {
if (!condition) {
throw new QuackeryException();
}
}
}
Original file line number Original file line Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.testanza; package org.quackery;


import static java.util.Arrays.asList; import static java.util.Arrays.asList;
import static org.testanza.Suite.newSuite; import static org.quackery.Suite.newSuite;


import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
Expand Down Expand Up @@ -38,7 +38,7 @@ public void run() {
return; return;
} }
} }
throw new TestanzaAssertionException("" // throw new QuackeryAssertionException("" //
+ "\n" // + "\n" //
+ " expected that\n" // + " expected that\n" //
+ " " + type.getName() + "\n" // + " " + type.getName() + "\n" //
Expand All @@ -55,7 +55,7 @@ public void run() throws Throwable {
Object[] toArray = collection.toArray(); Object[] toArray = collection.toArray();
boolean expected = Arrays.equals(toArray, new Object[0]); boolean expected = Arrays.equals(toArray, new Object[0]);
if (!expected) { if (!expected) {
throw new TestanzaAssertionException("" // throw new QuackeryAssertionException("" //
+ "\n" // + "\n" //
+ " Expected that\n" // + " Expected that\n" //
+ " " + type + "\n" // + " " + type + "\n" //
Expand All @@ -76,7 +76,7 @@ public void run() {
return; return;
} }
} }
throw new TestanzaAssertionException("" // throw new QuackeryAssertionException("" //
+ "\n" // + "\n" //
+ " expected that\n" // + " expected that\n" //
+ " " + type.getName() + "\n" // + " " + type.getName() + "\n" //
Expand All @@ -96,7 +96,7 @@ public void run() throws Throwable {
Object[] toArray = collection.toArray(); Object[] toArray = collection.toArray();
boolean expected = Arrays.equals(toArray, original.toArray()); boolean expected = Arrays.equals(toArray, original.toArray());
if (!expected) { if (!expected) {
throw new TestanzaAssertionException("" // throw new QuackeryAssertionException("" //
+ "\n" // + "\n" //
+ " Expected that\n" // + " Expected that\n" //
+ " " + type.getName() + "\n" // + " " + type.getName() + "\n" //
Expand All @@ -119,7 +119,7 @@ public void run() throws Throwable {
Collection<?> collection = null; Collection<?> collection = null;
try { try {
collection = (Collection<?>) constructor.newInstance((Object) null); collection = (Collection<?>) constructor.newInstance((Object) null);
throw new TestanzaAssertionException("" // throw new QuackeryAssertionException("" //
+ "\n" // + "\n" //
+ " Expected that\n" // + " Expected that\n" //
+ " " + type + "\n" // + " " + type + "\n" //
Expand All @@ -129,7 +129,7 @@ public void run() throws Throwable {
); );
} catch (InvocationTargetException e) { } catch (InvocationTargetException e) {
if (!(e.getCause() instanceof NullPointerException)) { if (!(e.getCause() instanceof NullPointerException)) {
throw new TestanzaAssertionException("" // throw new QuackeryAssertionException("" //
+ "\n" // + "\n" //
+ " Expected that\n" // + " Expected that\n" //
+ " " + type + "\n" // + " " + type + "\n" //
Expand All @@ -154,7 +154,7 @@ public void run() throws Throwable {
Object[] afterToArray = collection.toArray(); Object[] afterToArray = collection.toArray();
boolean expected = Arrays.equals(beforeToArray, afterToArray); boolean expected = Arrays.equals(beforeToArray, afterToArray);
if (!expected) { if (!expected) {
throw new TestanzaAssertionException("" // throw new QuackeryAssertionException("" //
+ "\n" // + "\n" //
+ " Expected that\n" // + " Expected that\n" //
+ " " + type + "\n" // + " " + type + "\n" //
Expand Down Expand Up @@ -186,7 +186,7 @@ public void run() throws Throwable {
Object[] argumentToArray = argument.toArray(); Object[] argumentToArray = argument.toArray();
boolean expected = Arrays.equals(argumentToArray, original.toArray()); boolean expected = Arrays.equals(argumentToArray, original.toArray());
if (!expected) { if (!expected) {
throw new TestanzaAssertionException("" // throw new QuackeryAssertionException("" //
+ "\n" // + "\n" //
+ " Expected that\n" // + " Expected that\n" //
+ " " + type + "\n" // + " " + type + "\n" //
Expand All @@ -207,7 +207,7 @@ private static Constructor<?> assumeConstructor(Class<?> type, Class<?>... param
try { try {
return type.getConstructor(parameters); return type.getConstructor(parameters);
} catch (NoSuchMethodException e) { } catch (NoSuchMethodException e) {
throw new TestanzaAssumptionException(e); throw new QuackeryAssumptionException(e);
} }
} }


Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.testanza; package org.quackery;


import static java.util.Arrays.asList; import static java.util.Arrays.asList;
import static java.util.Collections.unmodifiableList; import static java.util.Collections.unmodifiableList;
import static org.testanza.TestanzaException.check; import static org.quackery.QuackeryException.check;


import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.testanza; package org.quackery;


public interface Test { public interface Test {


Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.testanza; package org.quackery;


public interface Tester<T> { public interface Tester<T> {
Test test(T item); Test test(T item);
Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -1,12 +1,12 @@
package org.testanza; package org.quackery;


import static java.util.Arrays.asList; import static java.util.Arrays.asList;
import static java.util.Objects.deepEquals; import static java.util.Objects.deepEquals;
import static org.testanza.TestanzaException.check; import static org.quackery.QuackeryException.check;
import static org.testanza.common.Classes.fullName; import static org.quackery.common.Classes.fullName;
import static org.testanza.common.Classes.kind; import static org.quackery.common.Classes.kind;
import static org.testanza.common.Classes.modifiers; import static org.quackery.common.Classes.modifiers;
import static org.testanza.common.Classes.simpleName; import static org.quackery.common.Classes.simpleName;


import java.lang.reflect.AnnotatedElement; import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
Expand All @@ -21,7 +21,7 @@ public Test test(final AnnotatedElement element) {
+ Modifier.toString(modifier)) { + Modifier.toString(modifier)) {
public void run() { public void run() {
if (!hasModifier(modifier, element)) { if (!hasModifier(modifier, element)) {
throw new TestanzaAssertionException("" // throw new QuackeryAssertionException("" //
+ "\n" // + "\n" //
+ " expected that\n" // + " expected that\n" //
+ " " + fullName(element) + "\n" // + " " + fullName(element) + "\n" //
Expand All @@ -42,7 +42,7 @@ public Test test(final AnnotatedElement element) {
+ Modifier.toString(modifier)) { + Modifier.toString(modifier)) {
public void run() { public void run() {
if (hasModifier(modifier, element)) { if (hasModifier(modifier, element)) {
throw new TestanzaAssertionException("" // throw new QuackeryAssertionException("" //
+ "\n" // + "\n" //
+ " expected that\n" // + " expected that\n" //
+ " " + fullName(element) + "\n" // + " " + fullName(element) + "\n" //
Expand Down Expand Up @@ -71,7 +71,7 @@ && deepEquals(constructor.getParameterTypes(), parameters)) {
return; return;
} }
} }
throw new TestanzaAssertionException("" // throw new QuackeryAssertionException("" //
+ "\n" // + "\n" //
+ " expected that\n" // + " expected that\n" //
+ " " + type + "\n" // + " " + type + "\n" //
Expand All @@ -92,7 +92,7 @@ public Test test(final Class<?> item) {
return new Case(simpleName(item) + " is assignable to " + simpleName(type)) { return new Case(simpleName(item) + " is assignable to " + simpleName(type)) {
public void run() { public void run() {
if (!type.isAssignableFrom(item)) { if (!type.isAssignableFrom(item)) {
throw new TestanzaAssertionException("" // throw new QuackeryAssertionException("" //
+ "\n" // + "\n" //
+ " expected that\n" // + " expected that\n" //
+ " " + item + "\n" // + " " + item + "\n" //
Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.testanza.common; package org.quackery.common;


import java.lang.reflect.AnnotatedElement; import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
Expand Down
13 changes: 0 additions & 13 deletions main/java/org/testanza/TestanzaAssertionException.java

This file was deleted.

28 changes: 0 additions & 28 deletions main/java/org/testanza/TestanzaAssumptionException.java

This file was deleted.

23 changes: 0 additions & 23 deletions main/java/org/testanza/TestanzaException.java

This file was deleted.

Loading

0 comments on commit 10bc851

Please sign in to comment.