From 4825d1acffc17da7e264c79298a22e927d12bed8 Mon Sep 17 00:00:00 2001 From: Emil Sit Date: Thu, 31 Mar 2016 21:15:08 -0400 Subject: [PATCH 1/4] Initial POC of how to ignore all-but-first test Introduce a new JUnit test category that lets us mark certain tests as not ready for execution. The test task in the individual project can then be configured to not run tests marked as `NotReady`. For the CI server builds, add a fullTest test task that simply runs tests as normal, and link it into the check task so it runs on builds. This is not perfect, as the class under test must still compile, so it must have at least the correct signatures of all the methods tested. Also, it may be worth finding a way to distribute the NotReady interface that doesn't require checking it into every project. --- exercises/build.gradle | 7 +++++++ exercises/grade-school/build.gradle | 5 +++++ .../src/example/java/io/exercism/xjava/NotReady.java | 8 ++++++++ exercises/grade-school/src/test/java/SchoolTest.java | 8 ++++++++ 4 files changed, 28 insertions(+) create mode 100644 exercises/grade-school/src/example/java/io/exercism/xjava/NotReady.java diff --git a/exercises/build.gradle b/exercises/build.gradle index 8f4b5c772..ef371bb6c 100644 --- a/exercises/build.gradle +++ b/exercises/build.gradle @@ -19,4 +19,11 @@ subprojects { project -> println " (source = " + compileTask.source.asPath + ")" } } + + task fullTest(type: Test) { + group = LifecycleBasePlugin.VERIFICATION_GROUP + description = "Runs tests without exclusions." + } + + check.dependsOn(fullTest) } diff --git a/exercises/grade-school/build.gradle b/exercises/grade-school/build.gradle index 63e0ab503..d19152c82 100644 --- a/exercises/grade-school/build.gradle +++ b/exercises/grade-school/build.gradle @@ -11,3 +11,8 @@ dependencies { testCompile "org.assertj:assertj-core:3.2.0" } +test { + useJUnit { + excludeCategories 'io.exercism.xjava.NotReady' + } +} diff --git a/exercises/grade-school/src/example/java/io/exercism/xjava/NotReady.java b/exercises/grade-school/src/example/java/io/exercism/xjava/NotReady.java new file mode 100644 index 000000000..68d01566d --- /dev/null +++ b/exercises/grade-school/src/example/java/io/exercism/xjava/NotReady.java @@ -0,0 +1,8 @@ +package io.exercism.xjava; + +/** + * Marker interface used to exclude tests as you work + * through each exercise. + */ +public interface NotReady { +} diff --git a/exercises/grade-school/src/test/java/SchoolTest.java b/exercises/grade-school/src/test/java/SchoolTest.java index c1da9dd64..4bd17731c 100644 --- a/exercises/grade-school/src/test/java/SchoolTest.java +++ b/exercises/grade-school/src/test/java/SchoolTest.java @@ -1,5 +1,7 @@ import static org.assertj.core.api.Assertions.assertThat; +import io.exercism.xjava.NotReady; +import org.junit.experimental.categories.Category; import org.junit.Test; import java.util.Arrays; @@ -16,12 +18,14 @@ public void startsWithNoStudents() { } @Test + @Category(NotReady.class) public void addsStudents() { school.add("Aimee", 2); assertThat(school.db().get(2)).contains("Aimee"); } @Test + @Category(NotReady.class) public void addsMoreStudentsInSameGrade() { final int grade = 2; school.add("James", grade); @@ -32,6 +36,7 @@ public void addsMoreStudentsInSameGrade() { } @Test + @Category(NotReady.class) public void addsStudentsInMultipleGrades() { school.add("Chelsea", 3); school.add("Logan", 7); @@ -42,6 +47,7 @@ public void addsStudentsInMultipleGrades() { } @Test + @Category(NotReady.class) public void getsStudentsInAGrade() { school.add("Franklin", 5); school.add("Bradley", 5); @@ -50,11 +56,13 @@ public void getsStudentsInAGrade() { } @Test + @Category(NotReady.class) public void getsStudentsInEmptyGrade() { assertThat(school.grade(1)).isEmpty(); } @Test + @Category(NotReady.class) public void sortsSchool() { school.add("Jennifer", 4); school.add("Kareem", 6); From 869781b9c4da39c9619343a577f84bc39a3fdff6 Mon Sep 17 00:00:00 2001 From: "John S. Ryan" Date: Fri, 23 Sep 2016 21:00:12 -0700 Subject: [PATCH 2/4] Mark all but first test @Ignore in hello-world - in base build script, filter out @Ignores so that maintainers can run the full test suites. - increase the verbosity of test logging to aide in seeing progress as tests are un@Ignored and solved. - revamped GETTING_STARTED.md to reflect new output. It is now a complete guide from start to finish with calls-to-action at the end of the instructions. --- exercises/build.gradle | 20 +- exercises/grade-school/build.gradle | 6 - .../java/io/exercism/xjava/NotReady.java | 8 - .../src/test/java/SchoolTest.java | 8 - exercises/hello-world/GETTING_STARTED.md | 558 +++++++++++++++--- exercises/hello-world/build.gradle | 6 + .../hello-world/src/main/java/HelloWorld.java | 3 + .../src/test/java/HelloWorldTest.java | 3 + 8 files changed, 517 insertions(+), 95 deletions(-) delete mode 100644 exercises/grade-school/src/example/java/io/exercism/xjava/NotReady.java diff --git a/exercises/build.gradle b/exercises/build.gradle index ef371bb6c..9548a68bf 100644 --- a/exercises/build.gradle +++ b/exercises/build.gradle @@ -18,12 +18,24 @@ subprojects { project -> project["compileStarterSourceJava"].doFirst { compileTask -> println " (source = " + compileTask.source.asPath + ")" } + + // In lieu of being able to disable @Ignore in JUnit tests, we filter + // those annotations, placing the edited tests in the path named here. + test { + java.srcDirs = ["build/gen/test/java"] + } + project["compileTestJava"].doFirst { compileTask -> + println " (source = " + compileTask.source.asPath + ")" + } } - task fullTest(type: Test) { - group = LifecycleBasePlugin.VERIFICATION_GROUP - description = "Runs tests without exclusions." + task copyTestsFilteringIgnores(type: Copy) { + from "src/test/java" + into "build/gen/test/java" + filter { line -> + line.contains("@Ignore") ? null : line + } } - check.dependsOn(fullTest) + test.dependsOn(copyTestsFilteringIgnores) } diff --git a/exercises/grade-school/build.gradle b/exercises/grade-school/build.gradle index d19152c82..224669244 100644 --- a/exercises/grade-school/build.gradle +++ b/exercises/grade-school/build.gradle @@ -10,9 +10,3 @@ dependencies { testCompile "junit:junit:4.10" testCompile "org.assertj:assertj-core:3.2.0" } - -test { - useJUnit { - excludeCategories 'io.exercism.xjava.NotReady' - } -} diff --git a/exercises/grade-school/src/example/java/io/exercism/xjava/NotReady.java b/exercises/grade-school/src/example/java/io/exercism/xjava/NotReady.java deleted file mode 100644 index 68d01566d..000000000 --- a/exercises/grade-school/src/example/java/io/exercism/xjava/NotReady.java +++ /dev/null @@ -1,8 +0,0 @@ -package io.exercism.xjava; - -/** - * Marker interface used to exclude tests as you work - * through each exercise. - */ -public interface NotReady { -} diff --git a/exercises/grade-school/src/test/java/SchoolTest.java b/exercises/grade-school/src/test/java/SchoolTest.java index 4bd17731c..c1da9dd64 100644 --- a/exercises/grade-school/src/test/java/SchoolTest.java +++ b/exercises/grade-school/src/test/java/SchoolTest.java @@ -1,7 +1,5 @@ import static org.assertj.core.api.Assertions.assertThat; -import io.exercism.xjava.NotReady; -import org.junit.experimental.categories.Category; import org.junit.Test; import java.util.Arrays; @@ -18,14 +16,12 @@ public void startsWithNoStudents() { } @Test - @Category(NotReady.class) public void addsStudents() { school.add("Aimee", 2); assertThat(school.db().get(2)).contains("Aimee"); } @Test - @Category(NotReady.class) public void addsMoreStudentsInSameGrade() { final int grade = 2; school.add("James", grade); @@ -36,7 +32,6 @@ public void addsMoreStudentsInSameGrade() { } @Test - @Category(NotReady.class) public void addsStudentsInMultipleGrades() { school.add("Chelsea", 3); school.add("Logan", 7); @@ -47,7 +42,6 @@ public void addsStudentsInMultipleGrades() { } @Test - @Category(NotReady.class) public void getsStudentsInAGrade() { school.add("Franklin", 5); school.add("Bradley", 5); @@ -56,13 +50,11 @@ public void getsStudentsInAGrade() { } @Test - @Category(NotReady.class) public void getsStudentsInEmptyGrade() { assertThat(school.grade(1)).isEmpty(); } @Test - @Category(NotReady.class) public void sortsSchool() { school.add("Jennifer", 4); school.add("Kareem", 6); diff --git a/exercises/hello-world/GETTING_STARTED.md b/exercises/hello-world/GETTING_STARTED.md index 4a7168cb4..4bfc62b74 100644 --- a/exercises/hello-world/GETTING_STARTED.md +++ b/exercises/hello-world/GETTING_STARTED.md @@ -1,89 +1,176 @@ -# Getting Started +NOTE: You can also view the HTML version of this file here: +https://github.com/exercism/xjava/blob/master/exercises/hello-world/GETTING_STARTED.md -These exercises lean on Test-Driven Development (TDD), but they're not an exact match. +* [Solving "Hello, World!"](#solving-hello-world) + * [Reading Gradle output](#reading-gradle-output) + * [Fixing the first failing test](#fixing-the-first-failing-test) + * [Enabling and fixing the second test](#enabling-and-fixing-the-second-test) + * [Enabling the last test](#enabling-the-last-test) + * [Refactoring](#refactoring) +* [Submitting your first iteration](#submitting-your-first-iteration) +* [Next Steps](#next-steps) + * [Review (and comment on) others' submissions to this exercise](#review-and-comment-on-others-submissions-to-this-exercise) + * [Extend an exercise](#extend-an-exercise) -The following steps assume that you are in the base directory of the exercise. +---- -You must have `gradle` installed. +# Solving "Hello, World!" -## Step 1 +Welcome to the first exercise on the Java track! -Run the test suite. It's written using the JUnit framework, and can be run with gradle: +This is a step-by-step guide to solving this exercise. -```sh -$ gradle test -``` +Each exercise comes with a set of tests. The first pass through the +exercise is about getting all of the tests to pass, one at a time. -This will fail, complaining that there is no method called `hello` for the `HelloWorld` class. +If you have not installed the Java Development Kit and Gradle, you must do +so now. For help with this, see: http://exercism.io/languages/java/installing -To fix the error, open `src/main/java/HelloWorld.java` and add a `hello` method that returns a `String`. -The method can return an empty string `""` for now: +---- -```java -public class HelloWorld { - public static String hello() { - return ""; - } -} -``` +This guide picks-up where [Running the Tests (in Java)](http://exercism.io/languages/java/tests) +left off. If you haven't reviewed those instructions, do so now. -## Step 2 +The following instructions work equally well on Windows, Mac OS X and Linux. -Run the tests again. It will give you a new error, since now the method exists, but the tests expect the -method to accept one argument as input, a name. +## Reading Gradle output -The errors will look something like: +Use Gradle to run the tests: ``` $ gradle test +``` + +This command does a lot and displays a bunch of stuff. Let's break it down... + +``` :compileJava :processResources UP-TO-DATE :classes +``` + +Each line that begins with a colon (like `:compileJava`) is Gradle telling +us that it's starting that task. The first three tasks are about compiling +the source code of our *solution*. We've done you a favor and included just +enough code for the solution that it compiles. + +When a task is successful, it generally does not output anything. This is +why `:compileJava` and `:classes` do not produce any additional output. +`:processResources` reports that it had nothing to do. + +So far, so good... + +The next three tasks are about compiling source code of the *tests*. + +``` :compileTestJava -/exercism/exercises/java/hello-world/src/test/java/HelloWorldTest.java:9: error: method hello in class HelloWorld cannot be applied to given types; - assertEquals("Hello, World!", HelloWorld.hello("")); - ^ - required: no arguments - found: String - reason: actual and formal argument lists differ in length +:processTestResources UP-TO-DATE +:testClasses +``` - ... +... with both sets of source code successfully compiled, Gradle turns to +running the task you asked it to: executing the tests against the solution. -4 errors -:compileTestJava FAILED +``` +:test + +HelloWorldTest > helloNoName FAILED + java.lang.AssertionError: expected: but was: + at org.junit.Assert.fail(Assert.java:93) + at org.junit.Assert.failNotEquals(Assert.java:647) + at org.junit.Assert.assertEquals(Assert.java:128) + at org.junit.Assert.assertEquals(Assert.java:147) + at HelloWorldTest.helloNoName(HelloWorldTest.java:10) + +HelloWorldTest > helloSampleName SKIPPED + +HelloWorldTest > helloAnotherSampleName SKIPPED + +3 tests completed, 1 failed, 2 skipped +:test FAILED FAILURE: Build failed with an exception. * What went wrong: -Execution failed for task ':compileTestJava'. -> Compilation failed; see the compiler error output for details. +Execution failed for task ':test'. +> There were failing tests. See the report at: file:///Users/jtigger/projects/exercism/xjava/build/exercism/java/hello-world/build/reports/tests/index.html + +* Try: +Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. + +BUILD FAILED + +Total time: 6.716 secs +``` + +Seeing the word "fail" TEN TIMES might give you the impression you've done +something horribly wrong. You haven't. It's a whole lot of noise over +a single test not passing. + +Let's focus in on the important bits: + +``` +HelloWorldTest > helloNoName FAILED + java.lang.AssertionError: expected: but was: +``` + +...is read: "Within the test class named `HelloWorldTest`, the test method +`helloNoName` did not pass because the solution did not satisfy an +assertion. Apparently, we expected to see the string 'Hello, World!' but +the value `null` was returned instead. + +The last line of the stack trace tells us exactly where this unsatisfied +assertion lives: + ``` + at HelloWorldTest.helloNoName(HelloWorldTest.java:10) +``` + +Looks like the crime was discovered on line 10 in the test file. + +Knowing these two facts, + +1. the return value was not what was expected, and +2. the failure was on line 10 of the test, + +we can turn this failure into success. -### Fixing the Error -To fix it, open `src/main/java/HelloWorld.java` and add a `name` to the method the signature: + +## Fixing the first failing test + +In your favorite text editor, open `src/test/java/HelloWorldTest.java` +and go to line 10. ```java -public class HelloWorld { - public static String hello(String name) { - return ""; - } -} +assertEquals("Hello, World!", HelloWorld.hello("")); ``` -Now the `hello` method accepts a `name` as an input. +The test is expecting that `hello()`, when given an empty string (`""`), +returns "Hello, World!". Instead, `hello()` is returning `null`. +Let's fix that. -### Understanding Test Failures +Open `src/main/java/HelloWorld.java`. -Test failures will either be compilation errors or test failures. So far, we've been dealing with compilation -errors. Once our test and main code successful compile, `gradle` will run the actual test suite. +```java +public class HelloWorld { + public static String hello(String name) { + return null; + } +} +``` -## Step 3 +Let's change that to return the expected string: -Run the tests again. You'll notice that the gradle output passes the `:compileTestJava` phase and fails -at the `:test` phase. +```java +public class HelloWorld { + public static String hello(String name) { + return "Hello, World!"; + } +} +``` -The errors will look something like: +Save the file and run the tests again: ``` $ gradle test @@ -95,58 +182,322 @@ $ gradle test :testClasses :test -HelloWorldTest > helloNoName FAILED - org.junit.ComparisonFailure at HelloWorldTest.java:9 +HelloWorldTest > helloAnotherSampleName SKIPPED + +HelloWorldTest > helloNoName PASSED + +HelloWorldTest > helloSampleName SKIPPED + +BUILD SUCCESSFUL + +Total time: 4.523 secs +``` + +"BUILD SUCCESSFUL"! Woohoo! :) You can see that `helloNoName()` test is +now passing. + +With one win under our belt, we can turn our focus to some other messages +that we've been ignoring: the lines ending in "`SKIPPED`". + +Each test suite contains a series of tests, all of which have been marked +to be skipped/ignored except the first one. We did this to help you focus +on getting one test running at a time. +Let's tackle the next test... + + + +## Enabling and fixing the second test + +Right now, that second test is being skipped/ignored. Let's enable it. + +(Re)open `src/test/java/HelloWorldTest.java` and find the second test: + +```java ... +@Test +@Ignore +public void helloSampleName() { + assertEquals("Hello, Alice!", HelloWorld.hello("Alice")); +} +... +``` -3 tests completed, 3 failed -:test FAILED +When the JUnit test runner sees that `@Ignore` annotation on the test +method, it knows to skip over that test. Remove that line: + +```java +... +@Test +public void helloSampleName() { + assertEquals("Hello, Alice!", HelloWorld.hello("Alice")); +} +... +``` + +Now, when you run the tests, both tests run: + +```sh +$ gradle test +... +:test + +HelloWorldTest > helloNoName PASSED + +HelloWorldTest > helloSampleName FAILED + org.junit.ComparisonFailure: expected: but was: + at org.junit.Assert.assertEquals(Assert.java:125) + at org.junit.Assert.assertEquals(Assert.java:147) + at HelloWorldTest.helloSampleName(HelloWorldTest.java:16) + +HelloWorldTest > helloAnotherSampleName SKIPPED + +3 tests completed, 1 failed, 1 skipped +... ``` -These are actual test failures. It means that both our main and test java code is running but the test is -expecting one outcome, but getting another. +The first test, `helloNoName()` continues to pass. We see that +`helloSampleName` -- the test we just un-`@Ignore`'d -- is now running and +failing. Yay, failing test! In fact, the "failure" message is just +describing the difference between what the program does now and what it +should do for us to call it "done." -Open `src/test/java/HelloWorldTest.java` and go to line 9. +Right now, we've hardcoded the greeting. Enabling this second test has +unleashed a new expectation: that our program incorporate a name given +into that greeting. When given the name "`Alice`", that's who should be +greeted instead of "`World`". + +(Re)open `src/main/java/HelloWorld.java`. ```java -assertEquals("Hello, World!", HelloWorld.hello("")); +public class HelloWorld { + public static String hello(String name) { + return "Hello, World!"; + } +} +``` + +While `hello()` does accept a reference to a string named `name`, it is not +using it in the output. Let's change that: + + +```java +public class HelloWorld { + public static String hello(String name) { + return "Hello, " + name + "!"; + } +} +``` + +... and rerun the tests ... + +``` +$ gradle test +:test + +HelloWorldTest > helloAnotherSampleName SKIPPED + +HelloWorldTest > helloNoName FAILED + org.junit.ComparisonFailure: expected: but was: + at org.junit.Assert.assertEquals(Assert.java:125) + at org.junit.Assert.assertEquals(Assert.java:147) + at HelloWorldTest.helloNoName(HelloWorldTest.java:10) + +HelloWorldTest > helloSampleName PASSED + +3 tests completed, 1 failed, 1 skipped ``` -The test is expecting that `hello` returns "Hello, World!", when given an empty string (`""`) as input. -The easiest way to make the test pass is to return `"Hello, World!"` instead of `"". +Wait... didn't we just fix the test? Why is it failing? Take a closer look... +In fact, `helloSampleName()` *is* passing. It's just that at the same time, +we just inadvertently broke that first test: `helloNoName()`. + +This is one tiny example of the benefit of maintaining a test suite: if we +use them to drive out our code, the second we break the program the tests +say so. Since we saw them passing just *before* our latest change, +whatever we *just* did most likely cause that regression. + +Our latest change was making the greeting dependent on the name given. Our +first test expects that if either a blank string or null are given as the +name, then "`World`" should be substituted in. Let's implement that. + +`src/main/java/HelloWorld.java`: ```java public class HelloWorld { - public static String hello(String name) { - return "Hello, World!"; + public static String hello(String name) { + if(name == null || "".equals(name)) { + name = "World"; } + return "Hello, " + name + "!"; + } } ``` -## Wash, Rinse, Repeat +... and re-run the tests ... -Run the tests again. +``` +$ gradle test +... +:test -If it fails you're going to need to read the error message carefully to figure out what went wrong, fix the problem -in the main code, and then try again until all the tests pass. +HelloWorldTest > helloNoName PASSED + +HelloWorldTest > helloSampleName PASSED + +HelloWorldTest > helloAnotherSampleName SKIPPED + +BUILD SUCCESSFUL + +Total time: 4.804 secs +``` + +Excellent! We're now (at least) two-thirds the way done. Just one more +test to go... + + + +## Enabling the last test + +(Re)open `src/test/java/HelloWorldTest.java` and find the last test: + +```java +... +@Test +@Ignore +public void helloAnotherSampleName() { + assertEquals("Hello, Bob!", HelloWorld.hello("Bob")); +} +... +``` + +... and remove it's `@Ignore` to enable it ... + +```java +... +@Test +public void helloAnotherSampleName() { + assertEquals("Hello, Bob!", HelloWorld.hello("Bob")); +} +... +``` + +... and re-run the tests ... ``` $ gradle test -:compileJava +:compileJava UP-TO-DATE :processResources UP-TO-DATE -:classes +:classes UP-TO-DATE :compileTestJava :processTestResources UP-TO-DATE :testClasses :test +HelloWorldTest > helloNoName PASSED + +HelloWorldTest > helloSampleName PASSED + +HelloWorldTest > helloAnotherSampleName PASSED + BUILD SUCCESSFUL + +Total time: 6.953 secs ``` -## Submit +Oh, hello! Turns out, the solution we put into place didn't just apply for +"`Alice`" but "`Bob`" equally well. In this case, the test succeeded with +no additional code on our part. + + + +## Refactoring + +Now that you've got all the tests passing, you might consider whether +the code is in the most readable/maintainable/efficient shape. What makes +for "good" design of software is a big topic. The pursuit of it underlies +much of what makes up the more valuable conversations on Exercism. -When everything is passing, you can submit your code with the following command: +For now, let's just take a quick review of our solution and see if there's +any part of it we'd like to refactor. Refactoring is changing the the way +a bit of code reads without changing what it does. + +Right now, the details of detecting whether the caller of `hello()` has +given a name or not (i.e. `name` is either `null` or an empty string) is +sitting right next to the core responsibility of the method: to produce a +personalized greeting. + +```java +public class HelloWorld { + public static String hello(String name) { + if(name == null || "".equals(name)) { + name = "World"; + } + return "Hello, " + name + "!"; + } +} +``` + +How would things read if we extracted those details into a separate method +and at the same time, replaced the `if` with a ternary expression? + +```java +public class HelloWorld { + + public static String hello(String name) { + String whom = isBlank(name) ? "World" : name; + return "Hello, " + whom + "!"; + } + + private static boolean isBlank(String string) { + return string == null || "".equals(string); + } +} +``` + +By extracting that logic into the `isBlank()` method, we've added a little +abstraction to our program -- it's not as literal as it was before. Yet, +it allows us to defer *needing* to understand *how* "blankness" is +detected. If we can assume that `isBlank()` just works, we don't have to +downshift in our head to those details. Instead, we can remain at the same +level of thinking: to whom are we greeting? + +The ternary operator allowed us to express that choice in a more compact +form. Less to read without losing the intent. + +Finally, we introduced another variable: `whom`. Doing so gives a name to +the output of the ternary expression. We certainly could have continued +to reuse `name`, but by introducing a second `String` to hold the +calculated value this keeps crisp the two ideas: `name` is what's given +and `whom` is what's been determined. + +We made a bunch of changes, let's make sure we didn't break the program! + +``` +$ gradle test +... +HelloWorldTest > helloNoName PASSED + +HelloWorldTest > helloSampleName PASSED + +HelloWorldTest > helloAnotherSampleName PASSED +... +``` + +This illustrates another benefit of writing tests: you can make significant +changes to the structure of the program and very quickly restore your +confidence that the program still works. These tests are a far cry from a +"proof" of correctness, but well-written tests do a much better job of +(very quickly) giving us evidence that it is. Without them, we manually +run the program with different inputs and/or inspecting the code +line-by-line -- time-consuming and error prone. + + + +# Submitting your first iteration + +With a working solution that we've reviewed, we're ready to submit it to +exercism.io. ``` $ exercism submit src/main/java/HelloWorld.java @@ -154,3 +505,72 @@ $ exercism submit src/main/java/HelloWorld.java +# Next Steps + +From here, there are a number of paths you can take. + + +## Move on to the next exercise + +There are many more exercises you can practice with. Grab the next one! + +``` +$ exercism fetch java +``` + + +## Review (and comment on) others' submissions to this exercise + +The heart of Exercism are the conversations about coding +practices. It's definitely fun to practice, but engaging with others +both in their attempts and your own is how you get feedback. That feedback +can help point out what you're doing well and where you might need to +improve. + +Some submissions will be nearly identical to yours; others will be +completely different. Seeing both kinds can be instructive and interesting. + +Note that you can only view submissions of others for exercises you have +completed yourself. This enriches the experience of reading others' code +because you'll have your own experience of trying to solve the problem. + +Here's an up-to-date list of submissions on the Java track: + +http://exercism.io/tracks/java/exercises + + + +## Submit another iteration + +You are also encouraged to consider additional "requirements" on a given +exercise. + +For example, you could add a test or two that requires that the greeting +use the capitalized form on the person's name, regardless of the case they +used. + +In that situation, you'd write a test to set-up that new expectation and +then implement that in the code (the same process we just went through +together, above). + + + +## Contribute to Exercism + +The entire of Exercism is Open Source and is the labor of love for over +100 maintainers and many more contributors. + +A starting point to jumping in can be found here: + +https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md + + +---- + +Regardless of what you decide to do next, we sincerely hope you learn +and enjoy being part of this community. If at any time you need assistance +do not hesitate to ask for help: + +http://exercism.io/languages/java/help + +Cheers! diff --git a/exercises/hello-world/build.gradle b/exercises/hello-world/build.gradle index 1dd4b237b..6c3bd2608 100644 --- a/exercises/hello-world/build.gradle +++ b/exercises/hello-world/build.gradle @@ -10,3 +10,9 @@ dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/hello-world/src/main/java/HelloWorld.java b/exercises/hello-world/src/main/java/HelloWorld.java index 83d08e1f4..aa71b80d4 100644 --- a/exercises/hello-world/src/main/java/HelloWorld.java +++ b/exercises/hello-world/src/main/java/HelloWorld.java @@ -1,2 +1,5 @@ public class HelloWorld { + public static String hello(String name) { + return null; + } } diff --git a/exercises/hello-world/src/test/java/HelloWorldTest.java b/exercises/hello-world/src/test/java/HelloWorldTest.java index 6cc69583d..dfcf858b4 100644 --- a/exercises/hello-world/src/test/java/HelloWorldTest.java +++ b/exercises/hello-world/src/test/java/HelloWorldTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import static org.junit.Assert.assertEquals; @@ -11,11 +12,13 @@ public void helloNoName() { } @Test + @Ignore public void helloSampleName() { assertEquals("Hello, Alice!", HelloWorld.hello("Alice")); } @Test + @Ignore public void helloAnotherSampleName() { assertEquals("Hello, Bob!", HelloWorld.hello("Bob")); } From 35adc66f37b8629a5d46ef620efd3880d5dd53a6 Mon Sep 17 00:00:00 2001 From: "John S. Ryan" Date: Fri, 23 Sep 2016 22:09:28 -0700 Subject: [PATCH 3/4] Mark all but first test @Ignore in all exercises - in journey test, remove @Ignores so that test runs exercise all tests. - increase the verbosity of test logging to aide in seeing progress as tests are un@Ignored and solved. - saving scripts used to make changes to all exercises. These are the start of a library of scripts making such changes easier. - make Gradle output more CI-friendly. --- bin/journey-test.sh | 7 ++ config.json | 5 +- exercises/_template/build.gradle | 6 ++ exercises/accumulate/build.gradle | 6 ++ .../src/test/java/AccumulateTest.java | 6 ++ exercises/acronym/build.gradle | 6 ++ .../acronym/src/test/java/AcronymTest.java | 8 ++ exercises/allergies/build.gradle | 6 ++ .../src/test/java/AllergiesTest.java | 20 ++++ exercises/anagram/build.gradle | 6 ++ .../anagram/src/test/java/AnagramTest.java | 11 +++ exercises/atbash-cipher/build.gradle | 6 ++ .../src/test/java/AtbashTest.java | 7 +- exercises/beer-song/build.gradle | 6 ++ .../beer-song/src/test/java/BeerSongTest.java | 6 +- exercises/binary/build.gradle | 6 ++ .../binary/src/test/java/BinaryTest.java | 2 + exercises/bob/build.gradle | 6 ++ exercises/bob/src/test/java/BobTest.java | 19 ++++ exercises/build.gradle | 2 +- exercises/crypto-square/build.gradle | 6 ++ .../src/test/java/CryptoSquareTest.java | 16 ++++ exercises/etl/build.gradle | 6 ++ exercises/etl/src/test/java/EtlTest.java | 5 + exercises/gigasecond/build.gradle | 6 ++ .../src/test/java/GigasecondTest.java | 6 ++ exercises/grade-school/build.gradle | 6 ++ .../src/test/java/SchoolTest.java | 22 +++-- exercises/hamming/build.gradle | 6 ++ .../hamming/src/test/java/HammingTest.java | 10 ++ exercises/hello-world/build.gradle | 6 ++ .../src/test/java/HelloWorldTest.java | 2 + exercises/hexadecimal/build.gradle | 6 ++ .../src/test/java/HexadecimalTest.java | 11 +++ exercises/linked-list/build.gradle | 6 ++ .../linked-list/src/test/java/DequeTest.java | 6 ++ exercises/luhn/build.gradle | 6 ++ exercises/luhn/src/test/java/LuhnTest.java | 11 +++ exercises/meetup/build.gradle | 6 ++ .../meetup/src/test/java/MeetupTest.java | 92 +++++++++++++++++++ exercises/nth-prime/build.gradle | 6 ++ .../nth-prime/src/test/java/PrimeTest.java | 6 ++ exercises/nucleotide-count/build.gradle | 6 ++ .../src/test/java/NucleotideTest.java | 28 ++++-- exercises/octal/build.gradle | 6 ++ exercises/octal/src/test/java/OctalTest.java | 2 + exercises/pangram/build.gradle | 6 ++ .../pangram/src/test/java/PangramTest.java | 6 ++ exercises/pascals-triangle/build.gradle | 6 ++ .../src/test/java/PascalsTriangleTest.java | 7 ++ exercises/phone-number/build.gradle | 6 ++ .../src/test/java/PhoneNumberTest.java | 9 ++ exercises/pig-latin/build.gradle | 6 ++ .../pig-latin/src/test/java/PigLatinTest.java | 2 + exercises/prime-factors/build.gradle | 6 ++ .../src/test/java/PrimeFactorsTest.java | 2 + exercises/raindrops/build.gradle | 6 ++ .../src/test/java/RaindropsTest.java | 2 + exercises/rna-transcription/build.gradle | 6 ++ .../src/test/java/RnaTranscriptionTest.java | 7 ++ exercises/robot-name/build.gradle | 6 ++ .../robot-name/src/test/java/RobotTest.java | 4 + exercises/roman-numerals/build.gradle | 6 ++ .../src/test/java/RomanNumeralsTest.java | 2 + exercises/scrabble-score/build.gradle | 6 ++ .../src/test/java/ScrabbleScoreTest.java | 2 + exercises/sieve/build.gradle | 6 ++ exercises/sieve/src/test/java/SieveTest.java | 4 + exercises/simple-cipher/build.gradle | 6 ++ .../src/test/java/IncorrectKeyCipherTest.java | 6 ++ .../src/test/java/RandomKeyCipherTest.java | 7 ++ .../src/test/java/SubstitutionCipherTest.java | 9 ++ exercises/simple-linked-list/build.gradle | 6 ++ .../src/test/java/SimpleLinkedListTest.java | 8 ++ exercises/space-age/build.gradle | 6 ++ .../space-age/src/test/java/SpaceAgeTest.java | 10 ++ exercises/strain/build.gradle | 6 ++ .../strain/src/test/java/StrainTest.java | 13 +++ exercises/triangle/build.gradle | 6 ++ .../triangle/src/test/java/TriangleTest.java | 16 ++++ exercises/trinary/build.gradle | 6 ++ .../trinary/src/test/java/TrinaryTest.java | 5 + exercises/word-count/build.gradle | 6 ++ .../src/test/java/WordCountTest.java | 7 ++ scripts/increase-test-logging.sh | 21 +++++ scripts/insert-ignores.sh | 15 +++ 86 files changed, 693 insertions(+), 21 deletions(-) create mode 100755 scripts/increase-test-logging.sh create mode 100755 scripts/insert-ignores.sh diff --git a/bin/journey-test.sh b/bin/journey-test.sh index 0555cbf9c..92dfb5f39 100755 --- a/bin/journey-test.sh +++ b/bin/journey-test.sh @@ -3,6 +3,9 @@ SCRIPTPATH=$( pushd `dirname $0` > /dev/null && pwd && popd > /dev/null ) EXECPATH=$PWD XAPI_PID="" +# Makes CI output easier to read +TERM=dumb + function on_exit() { echo ">>> on_exit()" if [ "$XAPI_PID" != "" ] ; then @@ -177,6 +180,7 @@ solve_all_exercises() { local EXERCISES=`cat config.json | jq '.problems []' --raw-output` local TOTAL_EXERCISES=`cat config.json | jq '.problems | length'` local CURRENT_EXERCISE_NUMBER=1 + local TEMPFILE="${TMPDIR:-/tmp}/journey-test.sh-unignore_all_tests.txt" pushd ${EXERCISM_HOME} >/dev/null for EXERCISE in $EXERCISES; do @@ -186,6 +190,9 @@ solve_all_exercises() { $EXERCISM fetch java $EXERCISE cp -R -H $REPO_ROOT/exercises/$EXERCISE/src/example/java/* $EXERCISM_HOME/java/$EXERCISE/src/main/java/ pushd $EXERCISM_HOME/java/$EXERCISE/ >/dev/null + for TESTFILE in `find . -name "*Test.java"`; do + sed 's/@Ignore//' $TESTFILE > "$TEMPFILE" && mv "$TEMPFILE" "$TESTFILE" + done gradle test popd >/dev/null diff --git a/config.json b/config.json index e8cafbb7b..eba372175 100644 --- a/config.json +++ b/config.json @@ -246,7 +246,10 @@ "ignored": [ "_template", ".gradle", - "docs" + "build", + "docs", + "gradle", + "scripts" ], "foregone": [ "leap", diff --git a/exercises/_template/build.gradle b/exercises/_template/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/_template/build.gradle +++ b/exercises/_template/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/accumulate/build.gradle b/exercises/accumulate/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/accumulate/build.gradle +++ b/exercises/accumulate/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/accumulate/src/test/java/AccumulateTest.java b/exercises/accumulate/src/test/java/AccumulateTest.java index df4cfac4a..aa4dd8f4d 100644 --- a/exercises/accumulate/src/test/java/AccumulateTest.java +++ b/exercises/accumulate/src/test/java/AccumulateTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import java.util.Arrays; import java.util.LinkedList; @@ -8,6 +9,7 @@ public class AccumulateTest { + @Test public void emptyAccumulateProducesEmptyAccumulation() { List input = new LinkedList<>(); @@ -15,6 +17,7 @@ public void emptyAccumulateProducesEmptyAccumulation() { assertEquals(expectedOutput, Accumulate.accumulate(input, x -> x * x)); } + @Ignore @Test public void accumulateSquares() { List input = Arrays.asList(1, 2, 3); @@ -22,6 +25,7 @@ public void accumulateSquares() { assertEquals(expectedOutput, Accumulate.accumulate(input, x -> x * x)); } + @Ignore @Test public void accumulateUpperCases() { List input = Arrays.asList("hello", "world"); @@ -29,6 +33,7 @@ public void accumulateUpperCases() { assertEquals(expectedOutput, Accumulate.accumulate(input, x -> x.toUpperCase())); } + @Ignore @Test public void accumulateReversedStrings() { List input = Arrays.asList("the quick brown fox etc".split(" ")); @@ -40,6 +45,7 @@ private String reverse(String input) { return new StringBuilder(input).reverse().toString(); } + @Ignore @Test public void accumulateWithinAccumulate() { List input1 = Arrays.asList("a", "b", "c"); diff --git a/exercises/acronym/build.gradle b/exercises/acronym/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/acronym/build.gradle +++ b/exercises/acronym/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/acronym/src/test/java/AcronymTest.java b/exercises/acronym/src/test/java/AcronymTest.java index eba2635f5..bea27181a 100644 --- a/exercises/acronym/src/test/java/AcronymTest.java +++ b/exercises/acronym/src/test/java/AcronymTest.java @@ -1,9 +1,11 @@ import org.junit.Test; +import org.junit.Ignore; import static org.junit.Assert.assertEquals; public class AcronymTest { + @Test public void fromTitleCasedPhrases() { final String phrase = "Portable Network Graphics"; @@ -11,6 +13,7 @@ public void fromTitleCasedPhrases() { assertEquals(expected, Acronym.generate(phrase)); } + @Ignore @Test public void fromOtherTitleCasedPhrases() { final String phrase = "Ruby on Rails"; @@ -18,6 +21,7 @@ public void fromOtherTitleCasedPhrases() { assertEquals(expected, Acronym.generate(phrase)); } + @Ignore @Test public void fromInconsistentlyCasedPhrases() { final String phrase = "HyperText Markup Language"; @@ -25,6 +29,7 @@ public void fromInconsistentlyCasedPhrases() { assertEquals(expected, Acronym.generate(phrase)); } + @Ignore @Test public void fromPhrasesWithPunctuation() { final String phrase = "First In, First Out"; @@ -32,6 +37,7 @@ public void fromPhrasesWithPunctuation() { assertEquals(expected, Acronym.generate(phrase)); } + @Ignore @Test public void fromOtherPhrasesWithPunctuation() { final String phrase = "PHP: Hypertext Preprocessor"; @@ -39,6 +45,7 @@ public void fromOtherPhrasesWithPunctuation() { assertEquals(expected, Acronym.generate(phrase)); } + @Ignore @Test public void fromPhrasesWithPunctuationAndSentenceCasing() { final String phrase = "Complementary metal-oxide semiconductor"; @@ -46,6 +53,7 @@ public void fromPhrasesWithPunctuationAndSentenceCasing() { assertEquals(expected, Acronym.generate(phrase)); } + @Ignore @Test public void fromPhraseWithSingleLetterWord() { final String phrase = "Cat in a Hat"; diff --git a/exercises/allergies/build.gradle b/exercises/allergies/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/allergies/build.gradle +++ b/exercises/allergies/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/allergies/src/test/java/AllergiesTest.java b/exercises/allergies/src/test/java/AllergiesTest.java index f1e3c8494..6c7652abe 100644 --- a/exercises/allergies/src/test/java/AllergiesTest.java +++ b/exercises/allergies/src/test/java/AllergiesTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import java.util.Arrays; import java.util.List; @@ -7,6 +8,7 @@ public class AllergiesTest { + @Test public void noAllergiesMeansNotAllergicToAnything() { Allergies allergies = new Allergies(0); @@ -17,6 +19,7 @@ public void noAllergiesMeansNotAllergicToAnything() { assertEquals(false, allergies.isAllergicTo(Allergen.CATS)); } + @Ignore @Test public void allergicToEggs() { Allergies allergies = new Allergies(1); @@ -24,6 +27,7 @@ public void allergicToEggs() { assertEquals(true, allergies.isAllergicTo(Allergen.EGGS)); } + @Ignore @Test public void allergicToPeanuts() { Allergies allergies = new Allergies(2); @@ -31,6 +35,7 @@ public void allergicToPeanuts() { assertEquals(true, allergies.isAllergicTo(Allergen.PEANUTS)); } + @Ignore @Test public void allergicToShellfish() { Allergies allergies = new Allergies(4); @@ -38,6 +43,7 @@ public void allergicToShellfish() { assertEquals(true, allergies.isAllergicTo(Allergen.SHELLFISH)); } + @Ignore @Test public void allergicToStrawberries() { Allergies allergies = new Allergies(8); @@ -45,6 +51,7 @@ public void allergicToStrawberries() { assertEquals(true, allergies.isAllergicTo(Allergen.STRAWBERRIES)); } + @Ignore @Test public void allergicToTomatoes() { Allergies allergies = new Allergies(16); @@ -52,6 +59,7 @@ public void allergicToTomatoes() { assertEquals(true, allergies.isAllergicTo(Allergen.TOMATOES)); } + @Ignore @Test public void allergicToChocolate() { Allergies allergies = new Allergies(32); @@ -59,6 +67,7 @@ public void allergicToChocolate() { assertEquals(true, allergies.isAllergicTo(Allergen.CHOCOLATE)); } + @Ignore @Test public void allergicToPollen() { Allergies allergies = new Allergies(64); @@ -66,6 +75,7 @@ public void allergicToPollen() { assertEquals(true, allergies.isAllergicTo(Allergen.POLLEN)); } + @Ignore @Test public void allergicToCats() { Allergies allergies = new Allergies(128); @@ -73,6 +83,7 @@ public void allergicToCats() { assertEquals(true, allergies.isAllergicTo(Allergen.CATS)); } + @Ignore @Test public void isAllergicToEggsInAdditionToOtherStuff() { Allergies allergies = new Allergies(5); @@ -80,6 +91,7 @@ public void isAllergicToEggsInAdditionToOtherStuff() { assertEquals(true, allergies.isAllergicTo(Allergen.EGGS)); } + @Ignore @Test public void noAllergies() { Allergies allergies = new Allergies(0); @@ -87,6 +99,7 @@ public void noAllergies() { assertEquals(0, allergies.getList().size()); } + @Ignore @Test public void isAllergicToJustEggs() { Allergies allergies = new Allergies(1); @@ -95,6 +108,7 @@ public void isAllergicToJustEggs() { assertEquals(expectedAllergens, allergies.getList()); } + @Ignore @Test public void isAllergicToJustPeanuts() { Allergies allergies = new Allergies(2); @@ -103,6 +117,7 @@ public void isAllergicToJustPeanuts() { assertEquals(expectedAllergens, allergies.getList()); } + @Ignore @Test public void isAllergicToJustStrawberries() { Allergies allergies = new Allergies(8); @@ -111,6 +126,7 @@ public void isAllergicToJustStrawberries() { assertEquals(expectedAllergens, allergies.getList()); } + @Ignore @Test public void isAllergicToEggsAndPeanuts() { Allergies allergies = new Allergies(3); @@ -122,6 +138,7 @@ public void isAllergicToEggsAndPeanuts() { assertEquals(expectedAllergens, allergies.getList()); } + @Ignore @Test public void isAllergicToEggsAndShellfish() { Allergies allergies = new Allergies(5); @@ -133,6 +150,7 @@ public void isAllergicToEggsAndShellfish() { assertEquals(expectedAllergens, allergies.getList()); } + @Ignore @Test public void isAllergicToLotsOfStuff() { Allergies allergies = new Allergies(248); @@ -147,6 +165,7 @@ public void isAllergicToLotsOfStuff() { assertEquals(expectedAllergens, allergies.getList()); } + @Ignore @Test public void isAllergicToEverything() { Allergies allergies = new Allergies(255); @@ -164,6 +183,7 @@ public void isAllergicToEverything() { assertEquals(expectedAllergens, allergies.getList()); } + @Ignore @Test public void ignoreNonAllergenScoreParts() { Allergies allergies = new Allergies(509); diff --git a/exercises/anagram/build.gradle b/exercises/anagram/build.gradle index 224669244..991fec066 100644 --- a/exercises/anagram/build.gradle +++ b/exercises/anagram/build.gradle @@ -10,3 +10,9 @@ dependencies { testCompile "junit:junit:4.10" testCompile "org.assertj:assertj-core:3.2.0" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/anagram/src/test/java/AnagramTest.java b/exercises/anagram/src/test/java/AnagramTest.java index 7ad1c937f..b68d2308f 100644 --- a/exercises/anagram/src/test/java/AnagramTest.java +++ b/exercises/anagram/src/test/java/AnagramTest.java @@ -3,15 +3,18 @@ import java.util.Arrays; import java.util.List; import org.junit.Test; +import org.junit.Ignore; public class AnagramTest { + @Test public void testNoMatches() { Anagram detector = new Anagram("diaper"); assertThat(detector.match(Arrays.asList("hello", "world", "zombies", "pants"))).isEmpty(); } + @Ignore @Test public void testSimpleAnagram() { Anagram detector = new Anagram("ant"); @@ -19,6 +22,7 @@ public void testSimpleAnagram() { assertThat(anagram).containsExactly("tan"); } + @Ignore @Test public void testDetectMultipleAnagrams() { Anagram detector = new Anagram("master"); @@ -26,6 +30,7 @@ public void testDetectMultipleAnagrams() { assertThat(anagrams).contains("maters", "stream"); } + @Ignore @Test public void testDoesNotConfuseDifferentDuplicates() { Anagram detector = new Anagram("galea"); @@ -33,6 +38,7 @@ public void testDoesNotConfuseDifferentDuplicates() { assertThat(anagrams).isEmpty(); } + @Ignore @Test public void testIdenticalWordIsNotAnagram() { Anagram detector = new Anagram("corn"); @@ -40,18 +46,21 @@ public void testIdenticalWordIsNotAnagram() { assertThat(anagrams).containsExactly("cron"); } + @Ignore @Test public void testEliminateAnagramsWithSameChecksum() { Anagram detector = new Anagram("mass"); assertThat(detector.match(Arrays.asList("last")).isEmpty()); } + @Ignore @Test public void testEliminateAnagramSubsets() { Anagram detector = new Anagram("good"); assertThat(detector.match(Arrays.asList("dog", "goody"))).isEmpty(); } + @Ignore @Test public void testDetectAnagrams() { Anagram detector = new Anagram("listen"); @@ -59,6 +68,7 @@ public void testDetectAnagrams() { assertThat(anagrams).contains("inlets"); } + @Ignore @Test public void testMultipleAnagrams() { Anagram detector = new Anagram("allergy"); @@ -66,6 +76,7 @@ public void testMultipleAnagrams() { assertThat(anagrams).contains("gallery", "largely", "regally"); } + @Ignore @Test public void testAnagramsAreCaseInsensitive() { Anagram detector = new Anagram("Orchestra"); diff --git a/exercises/atbash-cipher/build.gradle b/exercises/atbash-cipher/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/atbash-cipher/build.gradle +++ b/exercises/atbash-cipher/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/atbash-cipher/src/test/java/AtbashTest.java b/exercises/atbash-cipher/src/test/java/AtbashTest.java index 356d1fca8..aa44ea175 100644 --- a/exercises/atbash-cipher/src/test/java/AtbashTest.java +++ b/exercises/atbash-cipher/src/test/java/AtbashTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import org.junit.experimental.runners.Enclosed; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -35,7 +36,8 @@ public EncodeTest(String input, String expectedOutput) { this.expectedOutput = expectedOutput; } - @Test + + @Test public void test() { assertEquals(expectedOutput, Atbash.encode(input)); } @@ -60,7 +62,8 @@ public DecodeTest(String input, String expectedOutput) { this.expectedOutput = expectedOutput; } - @Test + @Ignore + @Test public void test() { assertEquals(expectedOutput, Atbash.decode(input)); } diff --git a/exercises/beer-song/build.gradle b/exercises/beer-song/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/beer-song/build.gradle +++ b/exercises/beer-song/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/beer-song/src/test/java/BeerSongTest.java b/exercises/beer-song/src/test/java/BeerSongTest.java index 0544c4ebf..8944a8642 100644 --- a/exercises/beer-song/src/test/java/BeerSongTest.java +++ b/exercises/beer-song/src/test/java/BeerSongTest.java @@ -1,9 +1,11 @@ import org.junit.Test; +import org.junit.Ignore; import static org.junit.Assert.assertEquals; public class BeerSongTest { + @Test public void singOneVerse() { assertEquals("8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n", BeerSong.verse(8)); @@ -13,12 +15,14 @@ public void singOneVerse() { } + @Ignore @Test public void singMoreThanOneVerse() { assertEquals("8 bottles of beer on the wall, 8 bottles of beer.\nTake one down and pass it around, 7 bottles of beer on the wall.\n\n7 bottles of beer on the wall, 7 bottles of beer.\nTake one down and pass it around, 6 bottles of beer on the wall.\n\n6 bottles of beer on the wall, 6 bottles of beer.\nTake one down and pass it around, 5 bottles of beer on the wall.\n\n", BeerSong.sing(8,6)); assertEquals("3 bottles of beer on the wall, 3 bottles of beer.\nTake one down and pass it around, 2 bottles of beer on the wall.\n\n2 bottles of beer on the wall, 2 bottles of beer.\nTake one down and pass it around, 1 bottle of beer on the wall.\n\n1 bottle of beer on the wall, 1 bottle of beer.\nTake it down and pass it around, no more bottles of beer on the wall.\n\nNo more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 99 bottles of beer on the wall.\n\n",BeerSong.sing(3,0)); } + @Ignore @Test public void singEntireSong() { assertEquals("99 bottles of beer on the wall, 99 bottles of beer.\nTake one down and pass it around, 98 bottles of beer on the wall.\n\n" + @@ -124,4 +128,4 @@ public void singEntireSong() { BeerSong.singSong()); } -} \ No newline at end of file +} diff --git a/exercises/binary/build.gradle b/exercises/binary/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/binary/build.gradle +++ b/exercises/binary/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/binary/src/test/java/BinaryTest.java b/exercises/binary/src/test/java/BinaryTest.java index 36f68a486..f34c4ddbf 100644 --- a/exercises/binary/src/test/java/BinaryTest.java +++ b/exercises/binary/src/test/java/BinaryTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @@ -38,6 +39,7 @@ public BinaryTest(String input, int expectedOutput) { this.expectedOutput = expectedOutput; } + @Test public void test() { Binary binary = new Binary(input); diff --git a/exercises/bob/build.gradle b/exercises/bob/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/bob/build.gradle +++ b/exercises/bob/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/bob/src/test/java/BobTest.java b/exercises/bob/src/test/java/BobTest.java index a3d8ac6fb..54b76ddff 100644 --- a/exercises/bob/src/test/java/BobTest.java +++ b/exercises/bob/src/test/java/BobTest.java @@ -1,10 +1,12 @@ import org.junit.Test; +import org.junit.Ignore; import static org.junit.Assert.*; public class BobTest { private final Bob bob = new Bob(); + @Test public void saySomething() { assertEquals( @@ -13,6 +15,7 @@ public void saySomething() { ); } + @Ignore @Test public void shouting() { assertEquals( @@ -21,6 +24,7 @@ public void shouting() { ); } + @Ignore @Test public void askingAQuestion() { assertEquals( @@ -29,6 +33,7 @@ public void askingAQuestion() { ); } + @Ignore @Test public void askingANumericQuestion() { assertEquals( @@ -37,6 +42,7 @@ public void askingANumericQuestion() { ); } + @Ignore @Test public void talkingForcefully() { assertEquals( @@ -45,6 +51,7 @@ public void talkingForcefully() { ); } + @Ignore @Test public void usingAcronymsInRegularSpeech() { assertEquals( @@ -52,6 +59,7 @@ public void usingAcronymsInRegularSpeech() { ); } + @Ignore @Test public void forcefulQuestions() { assertEquals( @@ -59,6 +67,7 @@ public void forcefulQuestions() { ); } + @Ignore @Test public void shoutingNumbers() { assertEquals( @@ -66,6 +75,7 @@ public void shoutingNumbers() { ); } + @Ignore @Test public void onlyNumbers() { assertEquals( @@ -73,6 +83,7 @@ public void onlyNumbers() { ); } + @Ignore @Test public void questionWithOnlyNumbers() { assertEquals( @@ -80,6 +91,7 @@ public void questionWithOnlyNumbers() { ); } + @Ignore @Test public void shoutingWithSpecialCharacters() { assertEquals( @@ -87,6 +99,7 @@ public void shoutingWithSpecialCharacters() { ); } + @Ignore @Test public void shoutingWithUmlauts() { assertEquals( @@ -94,6 +107,7 @@ public void shoutingWithUmlauts() { ); } + @Ignore @Test public void calmlySpeakingWithUmlauts() { assertEquals( @@ -101,6 +115,7 @@ public void calmlySpeakingWithUmlauts() { ); } + @Ignore @Test public void shoutingWithNoExclamationMark() { assertEquals( @@ -108,6 +123,7 @@ public void shoutingWithNoExclamationMark() { ); } + @Ignore @Test public void statementContainingQuestionMark() { assertEquals( @@ -115,6 +131,7 @@ public void statementContainingQuestionMark() { ); } + @Ignore @Test public void prattlingOn() { assertEquals( @@ -122,6 +139,7 @@ public void prattlingOn() { ); } + @Ignore @Test public void silence() { assertEquals( @@ -129,6 +147,7 @@ public void silence() { ); } + @Ignore @Test public void prolongedSilence() { assertEquals( diff --git a/exercises/build.gradle b/exercises/build.gradle index 9548a68bf..2a5adefb6 100644 --- a/exercises/build.gradle +++ b/exercises/build.gradle @@ -33,7 +33,7 @@ subprojects { project -> from "src/test/java" into "build/gen/test/java" filter { line -> - line.contains("@Ignore") ? null : line + line.contains("@Ignore") ? "" : line } } diff --git a/exercises/crypto-square/build.gradle b/exercises/crypto-square/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/crypto-square/build.gradle +++ b/exercises/crypto-square/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/crypto-square/src/test/java/CryptoSquareTest.java b/exercises/crypto-square/src/test/java/CryptoSquareTest.java index 91cb5f943..a5b51ea37 100644 --- a/exercises/crypto-square/src/test/java/CryptoSquareTest.java +++ b/exercises/crypto-square/src/test/java/CryptoSquareTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import java.util.Arrays; import java.util.List; @@ -7,6 +8,7 @@ public class CryptoSquareTest { + @Test public void strangeCharactersAreStrippedDuringNormalization() { Crypto crypto = new Crypto("s#$%^&plunk"); @@ -15,6 +17,7 @@ public void strangeCharactersAreStrippedDuringNormalization() { assertEquals(expectedOutput, crypto.getNormalizedPlaintext()); } + @Ignore @Test public void lettersAreLowerCasedDuringNormalization() { Crypto crypto = new Crypto("WHOA HEY!"); @@ -23,6 +26,7 @@ public void lettersAreLowerCasedDuringNormalization() { assertEquals(expectedOutput, crypto.getNormalizedPlaintext()); } + @Ignore @Test public void numbersAreKeptDuringNormalization() { Crypto crypto = new Crypto("1, 2, 3, GO!"); @@ -31,6 +35,7 @@ public void numbersAreKeptDuringNormalization() { assertEquals(expectedOutput, crypto.getNormalizedPlaintext()); } + @Ignore @Test public void smallestSquareSizeIs2() { Crypto crypto = new Crypto("1234"); @@ -39,6 +44,7 @@ public void smallestSquareSizeIs2() { assertEquals(expectedOutput, crypto.getSquareSize()); } + @Ignore @Test public void sizeOfTextWhoseLengthIsPerfectSquareIsItsSquareRoot() { Crypto crypto = new Crypto("123456789"); @@ -47,6 +53,7 @@ public void sizeOfTextWhoseLengthIsPerfectSquareIsItsSquareRoot() { assertEquals(expectedOutput, crypto.getSquareSize()); } + @Ignore @Test public void sizeOfTextWhoseLengthIsNoPerfectSquareIsNextBiggestSquareRoot() { Crypto crypto = new Crypto("123456789abc"); @@ -55,6 +62,7 @@ public void sizeOfTextWhoseLengthIsNoPerfectSquareIsNextBiggestSquareRoot() { assertEquals(expectedOutput, crypto.getSquareSize()); } + @Ignore @Test public void sizeIsDeterminedByNormalizedText() { Crypto crypto = new Crypto("Oh hey, this is nuts!"); @@ -63,6 +71,7 @@ public void sizeIsDeterminedByNormalizedText() { assertEquals(expectedOutput, crypto.getSquareSize()); } + @Ignore @Test public void segmentsAreSplitBySquareSize() { Crypto crypto = new Crypto("Never vex thine heart with idle woes"); @@ -71,6 +80,7 @@ public void segmentsAreSplitBySquareSize() { assertEquals(expectedOutput, crypto.getPlaintextSegments()); } + @Ignore @Test public void segmentsAreSplitBySquareSizeUntilTextRunsOut() { Crypto crypto = new Crypto("ZOMG! ZOMBIES!!!"); @@ -79,6 +89,7 @@ public void segmentsAreSplitBySquareSizeUntilTextRunsOut() { assertEquals(expectedOutput, crypto.getPlaintextSegments()); } + @Ignore @Test public void cipherTextCombinesTextByColumn() { Crypto crypto = new Crypto("First, solve the problem. Then, write the code."); @@ -87,6 +98,7 @@ public void cipherTextCombinesTextByColumn() { assertEquals(expectedOutput, crypto.getCipherText()); } + @Ignore @Test public void cipherTextSkipsCellsWithNoText() { Crypto crypto = new Crypto("Time is an illusion. Lunchtime doubly so."); @@ -95,6 +107,7 @@ public void cipherTextSkipsCellsWithNoText() { assertEquals(expectedOutput, crypto.getCipherText()); } + @Ignore @Test public void normalizedCipherTextIsSplitByHeightOfSquare() { Crypto crypto = new Crypto("Vampires are people too!"); @@ -103,6 +116,7 @@ public void normalizedCipherTextIsSplitByHeightOfSquare() { assertEquals(expectedOutput, crypto.getNormalizedCipherText()); } + @Ignore @Test public void normalizedCipherNotExactlyDivisibleBy5SpillsIntoSmallerSegment() { Crypto crypto = new Crypto("Madness, and then illumination."); @@ -111,6 +125,7 @@ public void normalizedCipherNotExactlyDivisibleBy5SpillsIntoSmallerSegment() { assertEquals(expectedOutput, crypto.getNormalizedCipherText()); } + @Ignore @Test public void normalizedCipherIsSplitIntoSegmentsOfCorrectSize() { Crypto crypto = new Crypto("If man was meant to stay on the ground god would have given us roots"); @@ -119,6 +134,7 @@ public void normalizedCipherIsSplitIntoSegmentsOfCorrectSize() { assertEquals(expectedOutput, crypto.getNormalizedCipherText()); } + @Ignore @Test public void normalizedCipherTextIsSplitIntoSegmentsOfCorrectSizeWithPunctuation() { Crypto crypto = new Crypto("Have a nice day. Feed the dog & chill out!"); diff --git a/exercises/etl/build.gradle b/exercises/etl/build.gradle index 1e8cf56a8..7fbac6134 100644 --- a/exercises/etl/build.gradle +++ b/exercises/etl/build.gradle @@ -11,3 +11,9 @@ dependencies { testCompile "org.assertj:assertj-core:3.2.0" testCompile "com.google.guava:guava:16+" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/etl/src/test/java/EtlTest.java b/exercises/etl/src/test/java/EtlTest.java index dfedcbe0e..710deafd5 100644 --- a/exercises/etl/src/test/java/EtlTest.java +++ b/exercises/etl/src/test/java/EtlTest.java @@ -1,5 +1,6 @@ import com.google.common.collect.ImmutableMap; import org.junit.Test; +import org.junit.Ignore; import java.util.Arrays; import java.util.List; @@ -10,6 +11,7 @@ public class EtlTest { private final Etl etl = new Etl(); + @Test public void testTransformOneValue() { Map> old = ImmutableMap.of(1, Arrays.asList("A")); @@ -18,6 +20,7 @@ public void testTransformOneValue() { assertThat(etl.transform(old)).isEqualTo(expected); } + @Ignore @Test public void testTransformMoreValues() { Map> old = ImmutableMap.of( @@ -34,6 +37,7 @@ public void testTransformMoreValues() { assertThat(etl.transform(old)).isEqualTo(expected); } + @Ignore @Test public void testMoreKeys() { Map> old = ImmutableMap.of( @@ -50,6 +54,7 @@ public void testMoreKeys() { assertThat(etl.transform(old)).isEqualTo(expected); } + @Ignore @Test public void testFullDataset() { Map> old = ImmutableMap.>builder(). diff --git a/exercises/gigasecond/build.gradle b/exercises/gigasecond/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/gigasecond/build.gradle +++ b/exercises/gigasecond/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/gigasecond/src/test/java/GigasecondTest.java b/exercises/gigasecond/src/test/java/GigasecondTest.java index 5828a0ad4..0902f43c6 100644 --- a/exercises/gigasecond/src/test/java/GigasecondTest.java +++ b/exercises/gigasecond/src/test/java/GigasecondTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import java.time.LocalDate; import java.time.LocalDateTime; @@ -8,6 +9,7 @@ public class GigasecondTest { + @Test public void modernTime() { Gigasecond gigaSecond = new Gigasecond(LocalDate.of(2011, Month.APRIL, 25)); @@ -15,6 +17,7 @@ public void modernTime() { assertEquals(LocalDateTime.of(2043, Month.JANUARY, 1, 1, 46, 40), gigaSecond.getDate()); } + @Ignore @Test public void afterEpochTime() { Gigasecond gigaSecond = new Gigasecond(LocalDate.of(1977, Month.JUNE, 13)); @@ -22,6 +25,7 @@ public void afterEpochTime() { assertEquals(LocalDateTime.of(2009, Month.FEBRUARY, 19, 1, 46, 40), gigaSecond.getDate()); } + @Ignore @Test public void beforeEpochTime() { Gigasecond gigaSecond = new Gigasecond(LocalDate.of(1959, Month.JULY, 19)); @@ -29,6 +33,7 @@ public void beforeEpochTime() { assertEquals(LocalDateTime.of(1991, Month.MARCH, 27, 1, 46, 40), gigaSecond.getDate()); } + @Ignore @Test public void withFullTimeSpecified() { Gigasecond gigaSecond = new Gigasecond(LocalDateTime.of(2015, Month.JANUARY, 24, 22, 0, 0)); @@ -36,6 +41,7 @@ public void withFullTimeSpecified() { assertEquals(LocalDateTime.of(2046, Month.OCTOBER, 2, 23, 46, 40), gigaSecond.getDate()); } + @Ignore @Test public void withFullTimeSpecifiedAndDayRollover() { Gigasecond gigaSecond = new Gigasecond(LocalDateTime.of(2015, Month.JANUARY, 24, 23, 59, 59)); diff --git a/exercises/grade-school/build.gradle b/exercises/grade-school/build.gradle index 224669244..991fec066 100644 --- a/exercises/grade-school/build.gradle +++ b/exercises/grade-school/build.gradle @@ -10,3 +10,9 @@ dependencies { testCompile "junit:junit:4.10" testCompile "org.assertj:assertj-core:3.2.0" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/grade-school/src/test/java/SchoolTest.java b/exercises/grade-school/src/test/java/SchoolTest.java index c1da9dd64..68a4bd825 100644 --- a/exercises/grade-school/src/test/java/SchoolTest.java +++ b/exercises/grade-school/src/test/java/SchoolTest.java @@ -1,6 +1,7 @@ import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; +import org.junit.Ignore; import java.util.Arrays; import java.util.HashMap; @@ -10,18 +11,21 @@ public class SchoolTest { private final School school = new School(); - @Test + + @Test public void startsWithNoStudents() { assertThat(school.db()).isEmpty(); } - @Test + @Ignore + @Test public void addsStudents() { school.add("Aimee", 2); assertThat(school.db().get(2)).contains("Aimee"); } - @Test + @Ignore + @Test public void addsMoreStudentsInSameGrade() { final int grade = 2; school.add("James", grade); @@ -31,7 +35,8 @@ public void addsMoreStudentsInSameGrade() { assertThat(school.db().get(grade)).hasSize(3).contains("James", "Blair", "Paul"); } - @Test + @Ignore + @Test public void addsStudentsInMultipleGrades() { school.add("Chelsea", 3); school.add("Logan", 7); @@ -41,7 +46,8 @@ public void addsStudentsInMultipleGrades() { assertThat(school.db().get(7)).hasSize(1).contains("Logan"); } - @Test + @Ignore + @Test public void getsStudentsInAGrade() { school.add("Franklin", 5); school.add("Bradley", 5); @@ -49,12 +55,14 @@ public void getsStudentsInAGrade() { assertThat(school.grade(5)).hasSize(2).contains("Franklin", "Bradley"); } - @Test + @Ignore + @Test public void getsStudentsInEmptyGrade() { assertThat(school.grade(1)).isEmpty(); } - @Test + @Ignore + @Test public void sortsSchool() { school.add("Jennifer", 4); school.add("Kareem", 6); diff --git a/exercises/hamming/build.gradle b/exercises/hamming/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/hamming/build.gradle +++ b/exercises/hamming/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/hamming/src/test/java/HammingTest.java b/exercises/hamming/src/test/java/HammingTest.java index 04b643808..3ee1a415b 100644 --- a/exercises/hamming/src/test/java/HammingTest.java +++ b/exercises/hamming/src/test/java/HammingTest.java @@ -2,49 +2,59 @@ import static org.junit.Assert.*; import org.junit.Test; +import org.junit.Ignore; public class HammingTest { + @Test public void testNoDifferenceBetweenIdenticalStrands() { assertThat(Hamming.compute("A", "A"), is(0)); } + @Ignore @Test public void testCompleteHammingDistanceOfForSingleNucleotideStrand() { assertThat(Hamming.compute("A", "G"), is(1)); } + @Ignore @Test public void testCompleteHammingDistanceForSmallStrand() { assertThat(Hamming.compute("AG", "CT"), is(2)); } + @Ignore @Test public void testSmallHammingDistance() { assertThat(Hamming.compute("AT", "CT"), is(1)); } + @Ignore @Test public void testSmallHammingDistanceInLongerStrand() { assertThat(Hamming.compute("GGACG", "GGTCG"), is(1)); } + @Ignore @Test(expected = IllegalArgumentException.class) public void testValidatesFirstStrandNotLonger() { Hamming.compute("AAAG", "AAA"); } + @Ignore @Test(expected = IllegalArgumentException.class) public void testValidatesOtherStrandNotLonger() { Hamming.compute("AAA", "AAAG"); } + @Ignore @Test public void testLargeHammingDistance() { assertThat(Hamming.compute("GATACA", "GCATAA"), is(4)); } + @Ignore @Test public void testHammingDistanceInVeryLongStrand() { assertThat(Hamming.compute("GGACGGATTCTG", "AGGACGGATTCT"), is(9)); diff --git a/exercises/hello-world/build.gradle b/exercises/hello-world/build.gradle index 6c3bd2608..67f15c3b7 100644 --- a/exercises/hello-world/build.gradle +++ b/exercises/hello-world/build.gradle @@ -16,3 +16,9 @@ test { events = ["passed", "failed", "skipped"] } } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/hello-world/src/test/java/HelloWorldTest.java b/exercises/hello-world/src/test/java/HelloWorldTest.java index dfcf858b4..13574575d 100644 --- a/exercises/hello-world/src/test/java/HelloWorldTest.java +++ b/exercises/hello-world/src/test/java/HelloWorldTest.java @@ -1,10 +1,12 @@ import org.junit.Test; import org.junit.Ignore; +import org.junit.Ignore; import static org.junit.Assert.assertEquals; public class HelloWorldTest { + @Test public void helloNoName() { assertEquals("Hello, World!", HelloWorld.hello("")); diff --git a/exercises/hexadecimal/build.gradle b/exercises/hexadecimal/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/hexadecimal/build.gradle +++ b/exercises/hexadecimal/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/hexadecimal/src/test/java/HexadecimalTest.java b/exercises/hexadecimal/src/test/java/HexadecimalTest.java index 97ffa89e5..c81a02aa2 100644 --- a/exercises/hexadecimal/src/test/java/HexadecimalTest.java +++ b/exercises/hexadecimal/src/test/java/HexadecimalTest.java @@ -1,62 +1,73 @@ import org.junit.Test; +import org.junit.Ignore; import static org.junit.Assert.assertEquals; public class HexadecimalTest { + @Test public void testOne(){ int expected = 1; assertEquals(expected, Hexadecimal.toDecimal("1")); } + @Ignore @Test public void testC(){ int expected = 12; assertEquals(expected, Hexadecimal.toDecimal("c")); } + @Ignore @Test public void test10(){ int expected = 16; assertEquals(expected, Hexadecimal.toDecimal("10")); } + @Ignore @Test public void testAf(){ int expected = 175; assertEquals(expected, Hexadecimal.toDecimal("af")); } + @Ignore @Test public void test100(){ int expected = 256; assertEquals(expected, Hexadecimal.toDecimal("100")); } + @Ignore @Test public void test19ace(){ int expected = 105166; assertEquals(expected, Hexadecimal.toDecimal("19ace")); } + @Ignore @Test public void testInvalid(){ int expected = 0; assertEquals(expected, Hexadecimal.toDecimal("carrot")); } + @Ignore @Test public void testBlack(){ int expected = 0; assertEquals(expected, Hexadecimal.toDecimal("000000")); } + @Ignore @Test public void testWhite(){ int expected = 16777215; assertEquals(expected, Hexadecimal.toDecimal("ffffff")); } + @Ignore @Test public void testYellow(){ int expected = 16776960; diff --git a/exercises/linked-list/build.gradle b/exercises/linked-list/build.gradle index 224669244..991fec066 100644 --- a/exercises/linked-list/build.gradle +++ b/exercises/linked-list/build.gradle @@ -10,3 +10,9 @@ dependencies { testCompile "junit:junit:4.10" testCompile "org.assertj:assertj-core:3.2.0" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/linked-list/src/test/java/DequeTest.java b/exercises/linked-list/src/test/java/DequeTest.java index ff4b79d8a..f4ea27f9f 100644 --- a/exercises/linked-list/src/test/java/DequeTest.java +++ b/exercises/linked-list/src/test/java/DequeTest.java @@ -1,5 +1,6 @@ import org.junit.Before; import org.junit.Test; +import org.junit.Ignore; import static org.assertj.core.api.Assertions.assertThat; @@ -11,6 +12,7 @@ public void setUp() { subject = new Deque<>(); } + @Test public void testPushPop() { subject.push(10); @@ -19,6 +21,7 @@ public void testPushPop() { assertThat(subject.pop()).isEqualTo(10); } + @Ignore @Test public void testPushShift() { subject.push(10); @@ -27,6 +30,7 @@ public void testPushShift() { assertThat(subject.shift()).isEqualTo(20); } + @Ignore @Test public void testUnshiftShift() { subject.unshift(10); @@ -35,6 +39,7 @@ public void testUnshiftShift() { assertThat(subject.shift()).isEqualTo(10); } + @Ignore @Test public void testUnshiftPop() { subject.unshift(10); @@ -43,6 +48,7 @@ public void testUnshiftPop() { assertThat(subject.pop()).isEqualTo(20); } + @Ignore @Test public void testExample() { subject.push(10); diff --git a/exercises/luhn/build.gradle b/exercises/luhn/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/luhn/build.gradle +++ b/exercises/luhn/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/luhn/src/test/java/LuhnTest.java b/exercises/luhn/src/test/java/LuhnTest.java index 2bf6c69c8..159b68d0d 100644 --- a/exercises/luhn/src/test/java/LuhnTest.java +++ b/exercises/luhn/src/test/java/LuhnTest.java @@ -1,10 +1,12 @@ import org.junit.Test; +import org.junit.Ignore; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; public class LuhnTest { + @Test public void checkDigitIsRightMostDigit() { Luhn luhn = new Luhn(34567); @@ -13,6 +15,7 @@ public void checkDigitIsRightMostDigit() { assertEquals(expectedOutput, luhn.getCheckDigit()); } + @Ignore @Test public void addendsDoublesEveryOtherNumberFromRight() { Luhn luhn = new Luhn(12121); @@ -21,6 +24,7 @@ public void addendsDoublesEveryOtherNumberFromRight() { assertArrayEquals(expectedOutput, luhn.getAddends()); } + @Ignore @Test public void addendsSubtracts9WhenDoubledNumberIsMoreThan9() { Luhn luhn = new Luhn(8631); @@ -29,6 +33,7 @@ public void addendsSubtracts9WhenDoubledNumberIsMoreThan9() { assertArrayEquals(expectedOutput, luhn.getAddends()); } + @Ignore @Test public void checkSumAddsAddendsTogether1() { Luhn luhn = new Luhn(4913); @@ -37,6 +42,7 @@ public void checkSumAddsAddendsTogether1() { assertEquals(expectedOutput, luhn.getCheckSum()); } + @Ignore @Test public void checkSumAddsAddendsTogether2() { Luhn luhn = new Luhn(201773); @@ -45,6 +51,7 @@ public void checkSumAddsAddendsTogether2() { assertEquals(expectedOutput, luhn.getCheckSum()); } + @Ignore @Test public void numberIsValidWhenChecksumMod10IsZero1() { Luhn luhn = new Luhn(738); @@ -53,6 +60,7 @@ public void numberIsValidWhenChecksumMod10IsZero1() { assertEquals(expectedOutput, luhn.isValid()); } + @Ignore @Test public void numberIsValidWhenChecksumMod10IsZero2() { Luhn luhn = new Luhn(8739567); @@ -61,6 +69,7 @@ public void numberIsValidWhenChecksumMod10IsZero2() { assertEquals(expectedOutput, luhn.isValid()); } + @Ignore @Test public void luhnCanCreateSimpleNumbersWithValidCheckDigit() { long expectedOutput = 1230; @@ -68,6 +77,7 @@ public void luhnCanCreateSimpleNumbersWithValidCheckDigit() { assertEquals(expectedOutput, Luhn.create(123)); } + @Ignore @Test public void luhnCanCreateLargeNumbersWithValidCheckDigit() { long expectedOutput = 8739567; @@ -75,6 +85,7 @@ public void luhnCanCreateLargeNumbersWithValidCheckDigit() { assertEquals(expectedOutput, Luhn.create(873956)); } + @Ignore @Test public void luhnCanCreateHugeNumbersWithValidCheckDigit() { long expectedOutput = 8372637564L; diff --git a/exercises/meetup/build.gradle b/exercises/meetup/build.gradle index aac029459..ab3dbf0ef 100644 --- a/exercises/meetup/build.gradle +++ b/exercises/meetup/build.gradle @@ -11,3 +11,9 @@ dependencies { testCompile "junit:junit:4.10" testCompile "org.assertj:assertj-core:3.2.0" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/meetup/src/test/java/MeetupTest.java b/exercises/meetup/src/test/java/MeetupTest.java index dd25f1279..617179a9e 100644 --- a/exercises/meetup/src/test/java/MeetupTest.java +++ b/exercises/meetup/src/test/java/MeetupTest.java @@ -1,6 +1,7 @@ import org.joda.time.DateTime; import org.joda.time.DateTimeConstants; import org.junit.Test; +import org.junit.Ignore; import static org.assertj.core.api.Assertions.assertThat; import static org.joda.time.DateTimeConstants.*; @@ -9,6 +10,7 @@ * We use Joda Time here to encourage the use of a saner date manipulation library. */ public class MeetupTest { + @Test public void test_monteenth_of_may_2013() { DateTime expected = new DateTime(2013, 5, 13, 0, 0); @@ -16,6 +18,7 @@ public void test_monteenth_of_may_2013() { assertThat(meetup.day(MONDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_monteenth_of_august_2013() { DateTime expected = new DateTime(2013, 8, 19, 0, 0); @@ -23,6 +26,7 @@ public void test_monteenth_of_august_2013() { assertThat(meetup.day(MONDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_monteenth_of_september_2013() { DateTime expected = new DateTime(2013, 9, 16, 0, 0); @@ -30,6 +34,7 @@ public void test_monteenth_of_september_2013() { assertThat(meetup.day(MONDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_tuesteenth_of_march_2013() { DateTime expected = new DateTime(2013, 3, 19, 0, 0); @@ -37,6 +42,7 @@ public void test_tuesteenth_of_march_2013() { assertThat(meetup.day(TUESDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_tuesteenth_of_april_2013() { DateTime expected = new DateTime(2013, 4, 16, 0, 0); @@ -44,6 +50,7 @@ public void test_tuesteenth_of_april_2013() { assertThat(meetup.day(TUESDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_tuesteenth_of_august_2013() { DateTime expected = new DateTime(2013, 8, 13, 0, 0); @@ -51,6 +58,7 @@ public void test_tuesteenth_of_august_2013() { assertThat(meetup.day(TUESDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_wednesteenth_of_january_2013() { DateTime expected = new DateTime(2013, 1, 16, 0, 0); @@ -58,6 +66,7 @@ public void test_wednesteenth_of_january_2013() { assertThat(meetup.day(WEDNESDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_wednesteenth_of_february_2013() { DateTime expected = new DateTime(2013, 2, 13, 0, 0); @@ -65,6 +74,7 @@ public void test_wednesteenth_of_february_2013() { assertThat(meetup.day(WEDNESDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_wednesteenth_of_june_2013() { DateTime expected = new DateTime(2013, 6, 19, 0, 0); @@ -72,6 +82,7 @@ public void test_wednesteenth_of_june_2013() { assertThat(meetup.day(WEDNESDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_thursteenth_of_may_2013() { DateTime expected = new DateTime(2013, 5, 16, 0, 0); @@ -79,6 +90,7 @@ public void test_thursteenth_of_may_2013() { assertThat(meetup.day(THURSDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_thursteenth_of_june_2013() { DateTime expected = new DateTime(2013, 6, 13, 0, 0); @@ -86,6 +98,7 @@ public void test_thursteenth_of_june_2013() { assertThat(meetup.day(THURSDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_thursteenth_of_september_2013() { DateTime expected = new DateTime(2013, 9, 19, 0, 0); @@ -93,6 +106,7 @@ public void test_thursteenth_of_september_2013() { assertThat(meetup.day(THURSDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_friteenth_of_april_2013() { DateTime expected = new DateTime(2013, 4, 19, 0, 0); @@ -100,6 +114,7 @@ public void test_friteenth_of_april_2013() { assertThat(meetup.day(FRIDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_friteenth_of_august_2013() { DateTime expected = new DateTime(2013, 8, 16, 0, 0); @@ -107,6 +122,7 @@ public void test_friteenth_of_august_2013() { assertThat(meetup.day(FRIDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_friteenth_of_september_2013() { DateTime expected = new DateTime(2013, 9, 13, 0, 0); @@ -114,6 +130,7 @@ public void test_friteenth_of_september_2013() { assertThat(meetup.day(FRIDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_saturteenth_of_february_2013() { DateTime expected = new DateTime(2013, 2, 16, 0, 0); @@ -121,6 +138,7 @@ public void test_saturteenth_of_february_2013() { assertThat(meetup.day(SATURDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_saturteenth_of_april_2013() { DateTime expected = new DateTime(2013, 4, 13, 0, 0); @@ -128,6 +146,7 @@ public void test_saturteenth_of_april_2013() { assertThat(meetup.day(SATURDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_saturteenth_of_october_2013() { DateTime expected = new DateTime(2013, 10, 19, 0, 0); @@ -135,6 +154,7 @@ public void test_saturteenth_of_october_2013() { assertThat(meetup.day(SATURDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_sunteenth_of_may_2013() { DateTime expected = new DateTime(2013, 5, 19, 0, 0); @@ -142,6 +162,7 @@ public void test_sunteenth_of_may_2013() { assertThat(meetup.day(SUNDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_sunteenth_of_june_2013() { DateTime expected = new DateTime(2013, 6, 16, 0, 0); @@ -149,6 +170,7 @@ public void test_sunteenth_of_june_2013() { assertThat(meetup.day(SUNDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_sunteenth_of_october_2013() { DateTime expected = new DateTime(2013, 10, 13, 0, 0); @@ -156,6 +178,7 @@ public void test_sunteenth_of_october_2013() { assertThat(meetup.day(SUNDAY, MeetupSchedule.TEENTH)).isEqualTo(expected); } + @Ignore @Test public void test_first_monday_of_march_2013() { DateTime expected = new DateTime(2013, 3, 4, 0, 0); @@ -163,6 +186,7 @@ public void test_first_monday_of_march_2013() { assertThat(meetup.day(MONDAY, MeetupSchedule.FIRST)).isEqualTo(expected); } + @Ignore @Test public void test_first_monday_of_april_2013() { DateTime expected = new DateTime(2013, 4, 1, 0, 0); @@ -170,6 +194,7 @@ public void test_first_monday_of_april_2013() { assertThat(meetup.day(MONDAY, MeetupSchedule.FIRST)).isEqualTo(expected); } + @Ignore @Test public void test_first_tuesday_of_may_2013() { DateTime expected = new DateTime(2013, 5, 7, 0, 0); @@ -177,6 +202,7 @@ public void test_first_tuesday_of_may_2013() { assertThat(meetup.day(TUESDAY, MeetupSchedule.FIRST)).isEqualTo(expected); } + @Ignore @Test public void test_first_tuesday_of_june_2013() { DateTime expected = new DateTime(2013, 6, 4, 0, 0); @@ -184,6 +210,7 @@ public void test_first_tuesday_of_june_2013() { assertThat(meetup.day(TUESDAY, MeetupSchedule.FIRST)).isEqualTo(expected); } + @Ignore @Test public void test_first_wednesday_of_july_2013() { DateTime expected = new DateTime(2013, 7, 3, 0, 0); @@ -191,6 +218,7 @@ public void test_first_wednesday_of_july_2013() { assertThat(meetup.day(WEDNESDAY, MeetupSchedule.FIRST)).isEqualTo(expected); } + @Ignore @Test public void test_first_wednesday_of_august_2013() { DateTime expected = new DateTime(2013, 8, 7, 0, 0); @@ -198,6 +226,7 @@ public void test_first_wednesday_of_august_2013() { assertThat(meetup.day(WEDNESDAY, MeetupSchedule.FIRST)).isEqualTo(expected); } + @Ignore @Test public void test_first_thursday_of_september_2013() { DateTime expected = new DateTime(2013, 9, 5, 0, 0); @@ -205,6 +234,7 @@ public void test_first_thursday_of_september_2013() { assertThat(meetup.day(THURSDAY, MeetupSchedule.FIRST)).isEqualTo(expected); } + @Ignore @Test public void test_first_thursday_of_october_2013() { DateTime expected = new DateTime(2013, 10, 3, 0, 0); @@ -212,6 +242,7 @@ public void test_first_thursday_of_october_2013() { assertThat(meetup.day(THURSDAY, MeetupSchedule.FIRST)).isEqualTo(expected); } + @Ignore @Test public void test_first_friday_of_november_2013() { DateTime expected = new DateTime(2013, 11, 1, 0, 0); @@ -219,6 +250,7 @@ public void test_first_friday_of_november_2013() { assertThat(meetup.day(FRIDAY, MeetupSchedule.FIRST)).isEqualTo(expected); } + @Ignore @Test public void test_first_friday_of_december_2013() { DateTime expected = new DateTime(2013, 12, 6, 0, 0); @@ -226,6 +258,7 @@ public void test_first_friday_of_december_2013() { assertThat(meetup.day(FRIDAY, MeetupSchedule.FIRST)).isEqualTo(expected); } + @Ignore @Test public void test_first_saturday_of_january_2013() { DateTime expected = new DateTime(2013, 1, 5, 0, 0); @@ -233,6 +266,7 @@ public void test_first_saturday_of_january_2013() { assertThat(meetup.day(SATURDAY, MeetupSchedule.FIRST)).isEqualTo(expected); } + @Ignore @Test public void test_first_saturday_of_february_2013() { DateTime expected = new DateTime(2013, 2, 2, 0, 0); @@ -240,6 +274,7 @@ public void test_first_saturday_of_february_2013() { assertThat(meetup.day(SATURDAY, MeetupSchedule.FIRST)).isEqualTo(expected); } + @Ignore @Test public void test_first_sunday_of_march_2013() { DateTime expected = new DateTime(2013, 3, 3, 0, 0); @@ -247,6 +282,7 @@ public void test_first_sunday_of_march_2013() { assertThat(meetup.day(SUNDAY, MeetupSchedule.FIRST)).isEqualTo(expected); } + @Ignore @Test public void test_first_sunday_of_april_2013() { DateTime expected = new DateTime(2013, 4, 7, 0, 0); @@ -254,6 +290,7 @@ public void test_first_sunday_of_april_2013() { assertThat(meetup.day(SUNDAY, MeetupSchedule.FIRST)).isEqualTo(expected); } + @Ignore @Test public void test_second_monday_of_march_2013() { DateTime expected = new DateTime(2013, 3, 11, 0, 0); @@ -261,6 +298,7 @@ public void test_second_monday_of_march_2013() { assertThat(meetup.day(MONDAY, MeetupSchedule.SECOND)).isEqualTo(expected); } + @Ignore @Test public void test_second_monday_of_april_2013() { DateTime expected = new DateTime(2013, 4, 8, 0, 0); @@ -268,6 +306,7 @@ public void test_second_monday_of_april_2013() { assertThat(meetup.day(MONDAY, MeetupSchedule.SECOND)).isEqualTo(expected); } + @Ignore @Test public void test_second_tuesday_of_may_2013() { DateTime expected = new DateTime(2013, 5, 14, 0, 0); @@ -275,6 +314,7 @@ public void test_second_tuesday_of_may_2013() { assertThat(meetup.day(TUESDAY, MeetupSchedule.SECOND)).isEqualTo(expected); } + @Ignore @Test public void test_second_tuesday_of_june_2013() { DateTime expected = new DateTime(2013, 6, 11, 0, 0); @@ -282,6 +322,7 @@ public void test_second_tuesday_of_june_2013() { assertThat(meetup.day(TUESDAY, MeetupSchedule.SECOND)).isEqualTo(expected); } + @Ignore @Test public void test_second_wednesday_of_july_2013() { DateTime expected = new DateTime(2013, 7, 10, 0, 0); @@ -289,6 +330,7 @@ public void test_second_wednesday_of_july_2013() { assertThat(meetup.day(WEDNESDAY, MeetupSchedule.SECOND)).isEqualTo(expected); } + @Ignore @Test public void test_second_wednesday_of_august_2013() { DateTime expected = new DateTime(2013, 8, 14, 0, 0); @@ -296,6 +338,7 @@ public void test_second_wednesday_of_august_2013() { assertThat(meetup.day(WEDNESDAY, MeetupSchedule.SECOND)).isEqualTo(expected); } + @Ignore @Test public void test_second_thursday_of_september_2013() { DateTime expected = new DateTime(2013, 9, 12, 0, 0); @@ -303,6 +346,7 @@ public void test_second_thursday_of_september_2013() { assertThat(meetup.day(THURSDAY, MeetupSchedule.SECOND)).isEqualTo(expected); } + @Ignore @Test public void test_second_thursday_of_october_2013() { DateTime expected = new DateTime(2013, 10, 10, 0, 0); @@ -310,6 +354,7 @@ public void test_second_thursday_of_october_2013() { assertThat(meetup.day(THURSDAY, MeetupSchedule.SECOND)).isEqualTo(expected); } + @Ignore @Test public void test_second_friday_of_november_2013() { DateTime expected = new DateTime(2013, 11, 8, 0, 0); @@ -317,6 +362,7 @@ public void test_second_friday_of_november_2013() { assertThat(meetup.day(FRIDAY, MeetupSchedule.SECOND)).isEqualTo(expected); } + @Ignore @Test public void test_second_friday_of_december_2013() { DateTime expected = new DateTime(2013, 12, 13, 0, 0); @@ -324,6 +370,7 @@ public void test_second_friday_of_december_2013() { assertThat(meetup.day(FRIDAY, MeetupSchedule.SECOND)).isEqualTo(expected); } + @Ignore @Test public void test_second_saturday_of_january_2013() { DateTime expected = new DateTime(2013, 1, 12, 0, 0); @@ -331,6 +378,7 @@ public void test_second_saturday_of_january_2013() { assertThat(meetup.day(SATURDAY, MeetupSchedule.SECOND)).isEqualTo(expected); } + @Ignore @Test public void test_second_saturday_of_february_2013() { DateTime expected = new DateTime(2013, 2, 9, 0, 0); @@ -338,6 +386,7 @@ public void test_second_saturday_of_february_2013() { assertThat(meetup.day(SATURDAY, MeetupSchedule.SECOND)).isEqualTo(expected); } + @Ignore @Test public void test_second_sunday_of_march_2013() { DateTime expected = new DateTime(2013, 3, 10, 0, 0); @@ -345,6 +394,7 @@ public void test_second_sunday_of_march_2013() { assertThat(meetup.day(SUNDAY, MeetupSchedule.SECOND)).isEqualTo(expected); } + @Ignore @Test public void test_second_sunday_of_april_2013() { DateTime expected = new DateTime(2013, 4, 14, 0, 0); @@ -352,6 +402,7 @@ public void test_second_sunday_of_april_2013() { assertThat(meetup.day(SUNDAY, MeetupSchedule.SECOND)).isEqualTo(expected); } + @Ignore @Test public void test_third_monday_of_march_2013() { DateTime expected = new DateTime(2013, 3, 18, 0, 0); @@ -359,6 +410,7 @@ public void test_third_monday_of_march_2013() { assertThat(meetup.day(MONDAY, MeetupSchedule.THIRD)).isEqualTo(expected); } + @Ignore @Test public void test_third_monday_of_april_2013() { DateTime expected = new DateTime(2013, 4, 15, 0, 0); @@ -366,6 +418,7 @@ public void test_third_monday_of_april_2013() { assertThat(meetup.day(MONDAY, MeetupSchedule.THIRD)).isEqualTo(expected); } + @Ignore @Test public void test_third_tuesday_of_may_2013() { DateTime expected = new DateTime(2013, 5, 21, 0, 0); @@ -373,6 +426,7 @@ public void test_third_tuesday_of_may_2013() { assertThat(meetup.day(TUESDAY, MeetupSchedule.THIRD)).isEqualTo(expected); } + @Ignore @Test public void test_third_tuesday_of_june_2013() { DateTime expected = new DateTime(2013, 6, 18, 0, 0); @@ -380,6 +434,7 @@ public void test_third_tuesday_of_june_2013() { assertThat(meetup.day(TUESDAY, MeetupSchedule.THIRD)).isEqualTo(expected); } + @Ignore @Test public void test_third_wednesday_of_july_2013() { DateTime expected = new DateTime(2013, 7, 17, 0, 0); @@ -387,6 +442,7 @@ public void test_third_wednesday_of_july_2013() { assertThat(meetup.day(WEDNESDAY, MeetupSchedule.THIRD)).isEqualTo(expected); } + @Ignore @Test public void test_third_wednesday_of_august_2013() { DateTime expected = new DateTime(2013, 8, 21, 0, 0); @@ -394,6 +450,7 @@ public void test_third_wednesday_of_august_2013() { assertThat(meetup.day(WEDNESDAY, MeetupSchedule.THIRD)).isEqualTo(expected); } + @Ignore @Test public void test_third_thursday_of_september_2013() { DateTime expected = new DateTime(2013, 9, 19, 0, 0); @@ -401,6 +458,7 @@ public void test_third_thursday_of_september_2013() { assertThat(meetup.day(THURSDAY, MeetupSchedule.THIRD)).isEqualTo(expected); } + @Ignore @Test public void test_third_thursday_of_october_2013() { DateTime expected = new DateTime(2013, 10, 17, 0, 0); @@ -408,6 +466,7 @@ public void test_third_thursday_of_october_2013() { assertThat(meetup.day(THURSDAY, MeetupSchedule.THIRD)).isEqualTo(expected); } + @Ignore @Test public void test_third_friday_of_november_2013() { DateTime expected = new DateTime(2013, 11, 15, 0, 0); @@ -415,6 +474,7 @@ public void test_third_friday_of_november_2013() { assertThat(meetup.day(FRIDAY, MeetupSchedule.THIRD)).isEqualTo(expected); } + @Ignore @Test public void test_third_friday_of_december_2013() { DateTime expected = new DateTime(2013, 12, 20, 0, 0); @@ -422,6 +482,7 @@ public void test_third_friday_of_december_2013() { assertThat(meetup.day(FRIDAY, MeetupSchedule.THIRD)).isEqualTo(expected); } + @Ignore @Test public void test_third_saturday_of_january_2013() { DateTime expected = new DateTime(2013, 1, 19, 0, 0); @@ -429,6 +490,7 @@ public void test_third_saturday_of_january_2013() { assertThat(meetup.day(SATURDAY, MeetupSchedule.THIRD)).isEqualTo(expected); } + @Ignore @Test public void test_third_saturday_of_february_2013() { DateTime expected = new DateTime(2013, 2, 16, 0, 0); @@ -436,6 +498,7 @@ public void test_third_saturday_of_february_2013() { assertThat(meetup.day(SATURDAY, MeetupSchedule.THIRD)).isEqualTo(expected); } + @Ignore @Test public void test_third_sunday_of_march_2013() { DateTime expected = new DateTime(2013, 3, 17, 0, 0); @@ -443,6 +506,7 @@ public void test_third_sunday_of_march_2013() { assertThat(meetup.day(SUNDAY, MeetupSchedule.THIRD)).isEqualTo(expected); } + @Ignore @Test public void test_third_sunday_of_april_2013() { DateTime expected = new DateTime(2013, 4, 21, 0, 0); @@ -450,6 +514,7 @@ public void test_third_sunday_of_april_2013() { assertThat(meetup.day(SUNDAY, MeetupSchedule.THIRD)).isEqualTo(expected); } + @Ignore @Test public void test_fourth_monday_of_march_2013() { DateTime expected = new DateTime(2013, 3, 25, 0, 0); @@ -457,6 +522,7 @@ public void test_fourth_monday_of_march_2013() { assertThat(meetup.day(MONDAY, MeetupSchedule.FOURTH)).isEqualTo(expected); } + @Ignore @Test public void test_fourth_monday_of_april_2013() { DateTime expected = new DateTime(2013, 4, 22, 0, 0); @@ -464,6 +530,7 @@ public void test_fourth_monday_of_april_2013() { assertThat(meetup.day(MONDAY, MeetupSchedule.FOURTH)).isEqualTo(expected); } + @Ignore @Test public void test_fourth_tuesday_of_may_2013() { DateTime expected = new DateTime(2013, 5, 28, 0, 0); @@ -471,6 +538,7 @@ public void test_fourth_tuesday_of_may_2013() { assertThat(meetup.day(TUESDAY, MeetupSchedule.FOURTH)).isEqualTo(expected); } + @Ignore @Test public void test_fourth_tuesday_of_june_2013() { DateTime expected = new DateTime(2013, 6, 25, 0, 0); @@ -478,6 +546,7 @@ public void test_fourth_tuesday_of_june_2013() { assertThat(meetup.day(TUESDAY, MeetupSchedule.FOURTH)).isEqualTo(expected); } + @Ignore @Test public void test_fourth_wednesday_of_july_2013() { DateTime expected = new DateTime(2013, 7, 24, 0, 0); @@ -485,6 +554,7 @@ public void test_fourth_wednesday_of_july_2013() { assertThat(meetup.day(WEDNESDAY, MeetupSchedule.FOURTH)).isEqualTo(expected); } + @Ignore @Test public void test_fourth_wednesday_of_august_2013() { DateTime expected = new DateTime(2013, 8, 28, 0, 0); @@ -492,6 +562,7 @@ public void test_fourth_wednesday_of_august_2013() { assertThat(meetup.day(WEDNESDAY, MeetupSchedule.FOURTH)).isEqualTo(expected); } + @Ignore @Test public void test_fourth_thursday_of_september_2013() { DateTime expected = new DateTime(2013, 9, 26, 0, 0); @@ -499,6 +570,7 @@ public void test_fourth_thursday_of_september_2013() { assertThat(meetup.day(THURSDAY, MeetupSchedule.FOURTH)).isEqualTo(expected); } + @Ignore @Test public void test_fourth_thursday_of_october_2013() { DateTime expected = new DateTime(2013, 10, 24, 0, 0); @@ -506,6 +578,7 @@ public void test_fourth_thursday_of_october_2013() { assertThat(meetup.day(THURSDAY, MeetupSchedule.FOURTH)).isEqualTo(expected); } + @Ignore @Test public void test_fourth_friday_of_november_2013() { DateTime expected = new DateTime(2013, 11, 22, 0, 0); @@ -513,6 +586,7 @@ public void test_fourth_friday_of_november_2013() { assertThat(meetup.day(FRIDAY, MeetupSchedule.FOURTH)).isEqualTo(expected); } + @Ignore @Test public void test_fourth_friday_of_december_2013() { DateTime expected = new DateTime(2013, 12, 27, 0, 0); @@ -520,6 +594,7 @@ public void test_fourth_friday_of_december_2013() { assertThat(meetup.day(FRIDAY, MeetupSchedule.FOURTH)).isEqualTo(expected); } + @Ignore @Test public void test_fourth_saturday_of_january_2013() { DateTime expected = new DateTime(2013, 1, 26, 0, 0); @@ -527,6 +602,7 @@ public void test_fourth_saturday_of_january_2013() { assertThat(meetup.day(SATURDAY, MeetupSchedule.FOURTH)).isEqualTo(expected); } + @Ignore @Test public void test_fourth_saturday_of_february_2013() { DateTime expected = new DateTime(2013, 2, 23, 0, 0); @@ -534,6 +610,7 @@ public void test_fourth_saturday_of_february_2013() { assertThat(meetup.day(SATURDAY, MeetupSchedule.FOURTH)).isEqualTo(expected); } + @Ignore @Test public void test_fourth_sunday_of_march_2013() { DateTime expected = new DateTime(2013, 3, 24, 0, 0); @@ -541,6 +618,7 @@ public void test_fourth_sunday_of_march_2013() { assertThat(meetup.day(SUNDAY, MeetupSchedule.FOURTH)).isEqualTo(expected); } + @Ignore @Test public void test_fourth_sunday_of_april_2013() { DateTime expected = new DateTime(2013, 4, 28, 0, 0); @@ -548,6 +626,7 @@ public void test_fourth_sunday_of_april_2013() { assertThat(meetup.day(SUNDAY, MeetupSchedule.FOURTH)).isEqualTo(expected); } + @Ignore @Test public void test_last_monday_of_march_2013() { DateTime expected = new DateTime(2013, 3, 25, 0, 0); @@ -555,6 +634,7 @@ public void test_last_monday_of_march_2013() { assertThat(meetup.day(MONDAY, MeetupSchedule.LAST)).isEqualTo(expected); } + @Ignore @Test public void test_last_monday_of_april_2013() { DateTime expected = new DateTime(2013, 4, 29, 0, 0); @@ -562,6 +642,7 @@ public void test_last_monday_of_april_2013() { assertThat(meetup.day(MONDAY, MeetupSchedule.LAST)).isEqualTo(expected); } + @Ignore @Test public void test_last_tuesday_of_may_2013() { DateTime expected = new DateTime(2013, 5, 28, 0, 0); @@ -569,6 +650,7 @@ public void test_last_tuesday_of_may_2013() { assertThat(meetup.day(TUESDAY, MeetupSchedule.LAST)).isEqualTo(expected); } + @Ignore @Test public void test_last_tuesday_of_june_2013() { DateTime expected = new DateTime(2013, 6, 25, 0, 0); @@ -576,6 +658,7 @@ public void test_last_tuesday_of_june_2013() { assertThat(meetup.day(TUESDAY, MeetupSchedule.LAST)).isEqualTo(expected); } + @Ignore @Test public void test_last_wednesday_of_july_2013() { DateTime expected = new DateTime(2013, 7, 31, 0, 0); @@ -583,6 +666,7 @@ public void test_last_wednesday_of_july_2013() { assertThat(meetup.day(WEDNESDAY, MeetupSchedule.LAST)).isEqualTo(expected); } + @Ignore @Test public void test_last_wednesday_of_august_2013() { DateTime expected = new DateTime(2013, 8, 28, 0, 0); @@ -590,6 +674,7 @@ public void test_last_wednesday_of_august_2013() { assertThat(meetup.day(WEDNESDAY, MeetupSchedule.LAST)).isEqualTo(expected); } + @Ignore @Test public void test_last_thursday_of_september_2013() { DateTime expected = new DateTime(2013, 9, 26, 0, 0); @@ -597,6 +682,7 @@ public void test_last_thursday_of_september_2013() { assertThat(meetup.day(THURSDAY, MeetupSchedule.LAST)).isEqualTo(expected); } + @Ignore @Test public void test_last_thursday_of_october_2013() { DateTime expected = new DateTime(2013, 10, 31, 0, 0); @@ -604,6 +690,7 @@ public void test_last_thursday_of_october_2013() { assertThat(meetup.day(THURSDAY, MeetupSchedule.LAST)).isEqualTo(expected); } + @Ignore @Test public void test_last_friday_of_november_2013() { DateTime expected = new DateTime(2013, 11, 29, 0, 0); @@ -611,6 +698,7 @@ public void test_last_friday_of_november_2013() { assertThat(meetup.day(FRIDAY, MeetupSchedule.LAST)).isEqualTo(expected); } + @Ignore @Test public void test_last_friday_of_december_2013() { DateTime expected = new DateTime(2013, 12, 27, 0, 0); @@ -618,6 +706,7 @@ public void test_last_friday_of_december_2013() { assertThat(meetup.day(FRIDAY, MeetupSchedule.LAST)).isEqualTo(expected); } + @Ignore @Test public void test_last_saturday_of_january_2013() { DateTime expected = new DateTime(2013, 1, 26, 0, 0); @@ -625,6 +714,7 @@ public void test_last_saturday_of_january_2013() { assertThat(meetup.day(SATURDAY, MeetupSchedule.LAST)).isEqualTo(expected); } + @Ignore @Test public void test_last_saturday_of_february_2013() { DateTime expected = new DateTime(2013, 2, 23, 0, 0); @@ -632,6 +722,7 @@ public void test_last_saturday_of_february_2013() { assertThat(meetup.day(SATURDAY, MeetupSchedule.LAST)).isEqualTo(expected); } + @Ignore @Test public void test_last_sunday_of_march_2013() { DateTime expected = new DateTime(2013, 3, 31, 0, 0); @@ -639,6 +730,7 @@ public void test_last_sunday_of_march_2013() { assertThat(meetup.day(SUNDAY, MeetupSchedule.LAST)).isEqualTo(expected); } + @Ignore @Test public void test_last_sunday_of_april_2013() { DateTime expected = new DateTime(2013, 4, 28, 0, 0); diff --git a/exercises/nth-prime/build.gradle b/exercises/nth-prime/build.gradle index 224669244..991fec066 100644 --- a/exercises/nth-prime/build.gradle +++ b/exercises/nth-prime/build.gradle @@ -10,3 +10,9 @@ dependencies { testCompile "junit:junit:4.10" testCompile "org.assertj:assertj-core:3.2.0" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/nth-prime/src/test/java/PrimeTest.java b/exercises/nth-prime/src/test/java/PrimeTest.java index abd2cbb7f..93e2b390c 100644 --- a/exercises/nth-prime/src/test/java/PrimeTest.java +++ b/exercises/nth-prime/src/test/java/PrimeTest.java @@ -1,28 +1,34 @@ import org.junit.Test; +import org.junit.Ignore; import static org.assertj.core.api.Assertions.assertThat; public class PrimeTest { + @Test public void testFirstPrime() { assertThat(Prime.nth(1)).isEqualTo(2); } + @Ignore @Test public void testSecondPrime() { assertThat(Prime.nth(2)).isEqualTo(3); } + @Ignore @Test public void testSixthPrime() { assertThat(Prime.nth(6)).isEqualTo(13); } + @Ignore @Test public void testBigPrime() { assertThat(Prime.nth(10001)).isEqualTo(104743); } + @Ignore @Test(expected = IllegalArgumentException.class) public void testUndefinedPrime() { Prime.nth(0); diff --git a/exercises/nucleotide-count/build.gradle b/exercises/nucleotide-count/build.gradle index 63e0ab503..5850e3374 100644 --- a/exercises/nucleotide-count/build.gradle +++ b/exercises/nucleotide-count/build.gradle @@ -11,3 +11,9 @@ dependencies { testCompile "org.assertj:assertj-core:3.2.0" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/nucleotide-count/src/test/java/NucleotideTest.java b/exercises/nucleotide-count/src/test/java/NucleotideTest.java index 837c5f6a8..4a6df443e 100644 --- a/exercises/nucleotide-count/src/test/java/NucleotideTest.java +++ b/exercises/nucleotide-count/src/test/java/NucleotideTest.java @@ -2,15 +2,18 @@ import static org.assertj.core.api.Assertions.entry; import org.junit.Test; +import org.junit.Ignore; public class NucleotideTest { - @Test + + @Test public void testEmptyDnaStringHasNoAdenosine() { DNA dna = new DNA(""); assertThat(dna.count('A')).isEqualTo(0); } - @Test + @Ignore + @Test public void testEmptyDnaStringHasNoNucleotides() { DNA dna = new DNA(""); assertThat(dna.nucleotideCounts()).hasSize(4).contains( @@ -21,13 +24,15 @@ public void testEmptyDnaStringHasNoNucleotides() { ); } - @Test + @Ignore + @Test public void testRepetitiveCytidineGetsCounted() { DNA dna = new DNA("CCCCC"); assertThat(dna.count('C')).isEqualTo(5); } - @Test + @Ignore + @Test public void testRepetitiveSequenceWithOnlyGuanosine() { DNA dna = new DNA("GGGGGGGG"); assertThat(dna.nucleotideCounts()).hasSize(4).contains( @@ -38,20 +43,23 @@ public void testRepetitiveSequenceWithOnlyGuanosine() { ); } - @Test + @Ignore + @Test public void testCountsOnlyThymidine() { DNA dna = new DNA("GGGGGTAACCCGG"); assertThat(dna.count('T')).isEqualTo(1); } - @Test + @Ignore + @Test public void testCountsANucleotideOnlyOnce() { DNA dna = new DNA("CGATTGGG"); dna.count('T'); assertThat(dna.count('T')).isEqualTo(2); } - @Test + @Ignore + @Test public void testDnaCountsDoNotChangeAfterCountingAdenosine() { DNA dna = new DNA("GATTACA"); dna.count('A'); @@ -63,13 +71,15 @@ public void testDnaCountsDoNotChangeAfterCountingAdenosine() { ); } - @Test(expected = IllegalArgumentException.class) + @Ignore + @Test(expected = IllegalArgumentException.class) public void testValidatesNucleotides() { DNA dna = new DNA("GACT"); dna.count('X'); } - @Test + @Ignore + @Test public void testCountsAllNucleotides() { String s = "AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC"; DNA dna = new DNA(s); diff --git a/exercises/octal/build.gradle b/exercises/octal/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/octal/build.gradle +++ b/exercises/octal/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/octal/src/test/java/OctalTest.java b/exercises/octal/src/test/java/OctalTest.java index 89f167a9b..23327ee3f 100644 --- a/exercises/octal/src/test/java/OctalTest.java +++ b/exercises/octal/src/test/java/OctalTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -38,6 +39,7 @@ public OctalTest(String input, int expectedOutput) { this.expectedOutput = expectedOutput; } + @Test public void test() { Octal octal = new Octal(input); diff --git a/exercises/pangram/build.gradle b/exercises/pangram/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/pangram/build.gradle +++ b/exercises/pangram/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/pangram/src/test/java/PangramTest.java b/exercises/pangram/src/test/java/PangramTest.java index cc20288cd..dbc3534a1 100644 --- a/exercises/pangram/src/test/java/PangramTest.java +++ b/exercises/pangram/src/test/java/PangramTest.java @@ -1,30 +1,36 @@ import org.junit.Test; +import org.junit.Ignore; import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertFalse; public class PangramTest { + @Test public void emptySentence() { assertFalse(Pangrams.isPangram("")); } + @Ignore @Test public void testLowercasePangram() { assertTrue(Pangrams.isPangram("the quick brown fox jumps over the lazy dog")); } + @Ignore @Test public void missingCharacterX() { assertFalse(Pangrams.isPangram("a quick movement of the enemy will jeopardize five gunboats")); } + @Ignore @Test public void mixedCaseAndPunctuation() { assertTrue(Pangrams.isPangram("\"Five quacking Zephyrs jolt my wax bed.\"")); } + @Ignore @Test public void nonAsciiCharacters() { assertTrue(Pangrams.isPangram("Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich.")); diff --git a/exercises/pascals-triangle/build.gradle b/exercises/pascals-triangle/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/pascals-triangle/build.gradle +++ b/exercises/pascals-triangle/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java b/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java index ef6ed59d1..4cd1b7054 100644 --- a/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java +++ b/exercises/pascals-triangle/src/test/java/PascalsTriangleTest.java @@ -1,10 +1,12 @@ import org.junit.Test; +import org.junit.Ignore; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; public class PascalsTriangleTest { + @Test public void testTriangleWithFourRows() { int[][] expectedOutput = new int[][]{ @@ -17,6 +19,7 @@ public void testTriangleWithFourRows() { assertArrayEquals(expectedOutput, PascalsTriangle.computeTriangle(4)); } + @Ignore @Test public void testTriangleWithSixRows() { int[][] expectedOutput = new int[][]{ @@ -31,6 +34,7 @@ public void testTriangleWithSixRows() { assertArrayEquals(expectedOutput, PascalsTriangle.computeTriangle(6)); } + @Ignore @Test public void testExpectEmptyTriangle() { int[][] expectedOutput = new int[][]{ @@ -40,6 +44,7 @@ public void testExpectEmptyTriangle() { assertArrayEquals(expectedOutput, PascalsTriangle.computeTriangle(0)); } + @Ignore @Test public void testValidInput() { int[][] input = new int[][]{ @@ -53,6 +58,7 @@ public void testValidInput() { assertEquals(true, PascalsTriangle.isTriangle(input)); } + @Ignore @Test public void testInvalidInput() { int[][] input = new int[][]{ @@ -65,6 +71,7 @@ public void testInvalidInput() { assertEquals(false, PascalsTriangle.isTriangle(input)); } + @Ignore @Test(expected = IllegalArgumentException.class) public void testValidatesNotNegativeRows() { PascalsTriangle.computeTriangle(-1); diff --git a/exercises/phone-number/build.gradle b/exercises/phone-number/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/phone-number/build.gradle +++ b/exercises/phone-number/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/phone-number/src/test/java/PhoneNumberTest.java b/exercises/phone-number/src/test/java/PhoneNumberTest.java index 7c878b7c0..865093f5c 100644 --- a/exercises/phone-number/src/test/java/PhoneNumberTest.java +++ b/exercises/phone-number/src/test/java/PhoneNumberTest.java @@ -1,9 +1,11 @@ import org.junit.Test; +import org.junit.Ignore; import static org.junit.Assert.*; public class PhoneNumberTest { + @Test public void cleansNumber() { final String expectedNumber = "1234567890"; @@ -14,6 +16,7 @@ public void cleansNumber() { ); } + @Ignore @Test public void cleansNumberWithDots() { final String expectedNumber = "1234567890"; @@ -24,6 +27,7 @@ public void cleansNumberWithDots() { ); } + @Ignore @Test public void validWhen11DigitsAndFirstIs1() { final String expectedNumber = "1234567890"; @@ -34,6 +38,7 @@ public void validWhen11DigitsAndFirstIs1() { ); } + @Ignore @Test public void invalidWhenOnly11Digits() { final String expectedNumber = "0000000000"; @@ -44,6 +49,7 @@ public void invalidWhenOnly11Digits() { ); } + @Ignore @Test public void invalidWhen9Digits() { final String expectedNumber = "0000000000"; @@ -54,6 +60,7 @@ public void invalidWhen9Digits() { ); } + @Ignore @Test public void areaCode() { final String expectedAreaCode = "123"; @@ -64,6 +71,7 @@ public void areaCode() { ); } + @Ignore @Test public void prettyPrint() { final String expectedPrettyNumber = "(123) 456-7890"; @@ -74,6 +82,7 @@ public void prettyPrint() { ); } + @Ignore @Test public void prettyPrintWithFullUSPhoneNumber() { final String expectedPrettyNumber = "(123) 456-7890"; diff --git a/exercises/pig-latin/build.gradle b/exercises/pig-latin/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/pig-latin/build.gradle +++ b/exercises/pig-latin/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/pig-latin/src/test/java/PigLatinTest.java b/exercises/pig-latin/src/test/java/PigLatinTest.java index c235ed184..a82d2d03a 100644 --- a/exercises/pig-latin/src/test/java/PigLatinTest.java +++ b/exercises/pig-latin/src/test/java/PigLatinTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -63,6 +64,7 @@ public PigLatinTest(String input, String expectedOutput) { this.expectedOutput = expectedOutput; } + @Test public void test() { assertEquals(expectedOutput, PigLatin.translate(input)); diff --git a/exercises/prime-factors/build.gradle b/exercises/prime-factors/build.gradle index 1c1bdc995..019e5f323 100644 --- a/exercises/prime-factors/build.gradle +++ b/exercises/prime-factors/build.gradle @@ -10,3 +10,9 @@ dependencies { testCompile "junit:junit:4.12" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/prime-factors/src/test/java/PrimeFactorsTest.java b/exercises/prime-factors/src/test/java/PrimeFactorsTest.java index 5ee83bc88..22a5786b4 100644 --- a/exercises/prime-factors/src/test/java/PrimeFactorsTest.java +++ b/exercises/prime-factors/src/test/java/PrimeFactorsTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @@ -37,6 +38,7 @@ public PrimeFactorsTest(long input, List expectedOutput) { this.expectedOutput = expectedOutput; } + @Test public void test() { assertEquals(expectedOutput, PrimeFactors.getForNumber(input)); diff --git a/exercises/raindrops/build.gradle b/exercises/raindrops/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/raindrops/build.gradle +++ b/exercises/raindrops/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/raindrops/src/test/java/RaindropsTest.java b/exercises/raindrops/src/test/java/RaindropsTest.java index f38ecd040..7d850b603 100644 --- a/exercises/raindrops/src/test/java/RaindropsTest.java +++ b/exercises/raindrops/src/test/java/RaindropsTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @@ -50,6 +51,7 @@ public RaindropsTest(int input, String expectedOutput) { this.expectedOutput = expectedOutput; } + @Test public void test() { assertEquals(expectedOutput, Raindrops.convert(input)); diff --git a/exercises/rna-transcription/build.gradle b/exercises/rna-transcription/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/rna-transcription/build.gradle +++ b/exercises/rna-transcription/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/rna-transcription/src/test/java/RnaTranscriptionTest.java b/exercises/rna-transcription/src/test/java/RnaTranscriptionTest.java index 26af46f7f..1eb380a1a 100644 --- a/exercises/rna-transcription/src/test/java/RnaTranscriptionTest.java +++ b/exercises/rna-transcription/src/test/java/RnaTranscriptionTest.java @@ -1,33 +1,40 @@ import org.junit.Assert; import org.junit.Test; +import org.junit.Ignore; public class RnaTranscriptionTest { + @Test public void testRnaTranscriptionOfEmptyDnaIsEmptyRna() { Assert.assertEquals("", RnaTranscription.ofDna("")); } + @Ignore @Test public void testRnaTranscriptionOfCytosineIsGuanine() { Assert.assertEquals("G", RnaTranscription.ofDna("C")); } + @Ignore @Test public void testRnaTranscriptionOfGuanineIsCytosine() { Assert.assertEquals("C", RnaTranscription.ofDna("G")); } + @Ignore @Test public void testRnaTranscriptionOfThymineIsAdenine() { Assert.assertEquals("A", RnaTranscription.ofDna("T")); } + @Ignore @Test public void testRnaTranscriptionOfAdenineIsUracil() { Assert.assertEquals("U", RnaTranscription.ofDna("A")); } + @Ignore @Test public void testRnaTranscription() { Assert.assertEquals("UGCACCAGAAUU", RnaTranscription.ofDna("ACGTGGTCTTAA")); diff --git a/exercises/robot-name/build.gradle b/exercises/robot-name/build.gradle index 1dd4b237b..6c3bd2608 100644 --- a/exercises/robot-name/build.gradle +++ b/exercises/robot-name/build.gradle @@ -10,3 +10,9 @@ dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/robot-name/src/test/java/RobotTest.java b/exercises/robot-name/src/test/java/RobotTest.java index f2c34c841..ab9e2e080 100644 --- a/exercises/robot-name/src/test/java/RobotTest.java +++ b/exercises/robot-name/src/test/java/RobotTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.core.Is.is; @@ -10,16 +11,19 @@ public class RobotTest { private static final String EXPECTED_ROBOT_NAME_PATTERN = "[A-Z]{2}\\d{3}"; private final Robot robot = new Robot(); + @Test public void hasName() { assertIsValidName(robot.getName()); } + @Ignore @Test public void differentRobotsHaveDifferentNames() { assertThat(robot.getName(), not(equalTo(new Robot().getName()))); } + @Ignore @Test public void resetName() { final String name = robot.getName(); diff --git a/exercises/roman-numerals/build.gradle b/exercises/roman-numerals/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/roman-numerals/build.gradle +++ b/exercises/roman-numerals/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/roman-numerals/src/test/java/RomanNumeralsTest.java b/exercises/roman-numerals/src/test/java/RomanNumeralsTest.java index 66cfd156b..9e264130c 100644 --- a/exercises/roman-numerals/src/test/java/RomanNumeralsTest.java +++ b/exercises/roman-numerals/src/test/java/RomanNumeralsTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @@ -44,6 +45,7 @@ public RomanNumeralsTest(int input, String expectedOutput) { this.expectedOutput = expectedOutput; } + @Test public void convertArabicNumberalToRomanNumeral() { RomanNumeral romanNumeral = new RomanNumeral(input); diff --git a/exercises/scrabble-score/build.gradle b/exercises/scrabble-score/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/scrabble-score/build.gradle +++ b/exercises/scrabble-score/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/scrabble-score/src/test/java/ScrabbleScoreTest.java b/exercises/scrabble-score/src/test/java/ScrabbleScoreTest.java index 2d9dce202..161129871 100644 --- a/exercises/scrabble-score/src/test/java/ScrabbleScoreTest.java +++ b/exercises/scrabble-score/src/test/java/ScrabbleScoreTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -33,6 +34,7 @@ public ScrabbleScoreTest(String input, int expectedOutput) { this.expectedOutput = expectedOutput; } + @Test public void test() { Scrabble scrabble = new Scrabble(input); diff --git a/exercises/sieve/build.gradle b/exercises/sieve/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/sieve/build.gradle +++ b/exercises/sieve/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/sieve/src/test/java/SieveTest.java b/exercises/sieve/src/test/java/SieveTest.java index cf53736d6..dacd3cc1d 100644 --- a/exercises/sieve/src/test/java/SieveTest.java +++ b/exercises/sieve/src/test/java/SieveTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import java.util.Arrays; import java.util.List; @@ -7,6 +8,7 @@ public class SieveTest { + @Test public void findFirstPrime() { Sieve sieve = new Sieve(2); @@ -15,6 +17,7 @@ public void findFirstPrime() { assertEquals(expectedOutput, sieve.getPrimes()); } + @Ignore @Test public void findPrimesUpTo10() { Sieve sieve = new Sieve(10); @@ -23,6 +26,7 @@ public void findPrimesUpTo10() { assertEquals(expectedOutput, sieve.getPrimes()); } + @Ignore @Test public void findPrimesUpTo1000() { Sieve sieve = new Sieve(1000); diff --git a/exercises/simple-cipher/build.gradle b/exercises/simple-cipher/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/simple-cipher/build.gradle +++ b/exercises/simple-cipher/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/simple-cipher/src/test/java/IncorrectKeyCipherTest.java b/exercises/simple-cipher/src/test/java/IncorrectKeyCipherTest.java index 7f0e65eaa..8158d9cad 100644 --- a/exercises/simple-cipher/src/test/java/IncorrectKeyCipherTest.java +++ b/exercises/simple-cipher/src/test/java/IncorrectKeyCipherTest.java @@ -1,27 +1,33 @@ import org.junit.Test; +import org.junit.Ignore; public class IncorrectKeyCipherTest { + @Test(expected = IllegalArgumentException.class) public void cipherThrowsWithAllCapsKey() { new Cipher("ABCDEF"); } + @Ignore @Test(expected = IllegalArgumentException.class) public void cipherThrowsWithAnyCapsKey() { new Cipher("abcdEFg"); } + @Ignore @Test(expected = IllegalArgumentException.class) public void cipherThrowsWithNumericKey() { new Cipher("12345"); } + @Ignore @Test(expected = IllegalArgumentException.class) public void cipherThrowsWithAnyNumericKey() { new Cipher("abcd345ef"); } + @Ignore @Test(expected = IllegalArgumentException.class) public void cipherThrowsWithEmptyKey() { new Cipher(""); diff --git a/exercises/simple-cipher/src/test/java/RandomKeyCipherTest.java b/exercises/simple-cipher/src/test/java/RandomKeyCipherTest.java index 9acd0eca4..a8cb3756d 100644 --- a/exercises/simple-cipher/src/test/java/RandomKeyCipherTest.java +++ b/exercises/simple-cipher/src/test/java/RandomKeyCipherTest.java @@ -1,5 +1,6 @@ import org.junit.Before; import org.junit.Test; +import org.junit.Ignore; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; @@ -13,16 +14,19 @@ public void setup() { this.cipher = new Cipher(); } + @Test public void cipherKeyIsMadeOfLetters() { assertTrue(cipher.getKey().matches("[a-z]+")); } + @Ignore @Test public void defaultCipherKeyIs100Characters() { assertEquals(100, cipher.getKey().length()); } + @Ignore @Test public void cipherKeysAreRandomlyGenerated() { assertTrue(!(new Cipher().getKey().equals(cipher.getKey()))); @@ -32,6 +36,7 @@ public void cipherKeysAreRandomlyGenerated() { * Here we take advantage of the fact that plaintext of "aaa..." doesn't output the key. This is a critical problem * with shift ciphers, some characters will always output the key verbatim. */ + @Ignore @Test public void cipherCanEncode() { String expectedOutput = cipher.getKey().substring(0, 10); @@ -39,6 +44,7 @@ public void cipherCanEncode() { assertEquals(expectedOutput, cipher.encode("aaaaaaaaaa")); } + @Ignore @Test public void cipherCanDecode() { String expectedOutput = "aaaaaaaaaa"; @@ -46,6 +52,7 @@ public void cipherCanDecode() { assertEquals(expectedOutput, cipher.decode(cipher.getKey().substring(0, 10))); } + @Ignore @Test public void cipherIsReversible() { String plainText = "abcdefghij"; diff --git a/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java b/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java index a68ecab2c..ad92a502e 100644 --- a/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java +++ b/exercises/simple-cipher/src/test/java/SubstitutionCipherTest.java @@ -1,5 +1,6 @@ import org.junit.Before; import org.junit.Test; +import org.junit.Ignore; import static org.junit.Assert.assertEquals; @@ -13,11 +14,13 @@ public void setup() { this.cipher = new Cipher(KEY); } + @Test public void cipherKeepsTheSubmittedKey() { assertEquals(KEY, cipher.getKey()); } + @Ignore @Test public void cipherCanEncodeWithGivenKey() { String expectedOutput = "abcdefghij"; @@ -25,6 +28,7 @@ public void cipherCanEncodeWithGivenKey() { assertEquals(expectedOutput, cipher.encode("aaaaaaaaaa")); } + @Ignore @Test public void cipherCanDecodeWithGivenKey() { String expectedOutput = "aaaaaaaaaa"; @@ -32,6 +36,7 @@ public void cipherCanDecodeWithGivenKey() { assertEquals(expectedOutput, cipher.decode("abcdefghij")); } + @Ignore @Test public void cipherIsReversibleGivenKey() { String plainText = "abcdefghij"; @@ -39,6 +44,7 @@ public void cipherIsReversibleGivenKey() { assertEquals(plainText, cipher.decode(cipher.encode("abcdefghij"))); } + @Ignore @Test public void cipherCanDoubleShiftEncode() { String plainText = "iamapandabear"; @@ -47,6 +53,7 @@ public void cipherCanDoubleShiftEncode() { assertEquals(expectedOutput, new Cipher(plainText).encode(plainText)); } + @Ignore @Test public void cipherCanWrapEncode() { String expectedOutput = "zabcdefghi"; @@ -54,6 +61,7 @@ public void cipherCanWrapEncode() { assertEquals(expectedOutput, cipher.encode("zzzzzzzzzz")); } + @Ignore @Test public void cipherCanEncodeMessageThatIsShorterThanTheKey() { String expectedOutput = "abcde"; @@ -61,6 +69,7 @@ public void cipherCanEncodeMessageThatIsShorterThanTheKey() { assertEquals(expectedOutput, cipher.encode("aaaaa")); } + @Ignore @Test public void cipherCanDecodeMessageThatIsShorterThanTheKey() { String expectedOutput = "aaaaa"; diff --git a/exercises/simple-linked-list/build.gradle b/exercises/simple-linked-list/build.gradle index 224669244..991fec066 100644 --- a/exercises/simple-linked-list/build.gradle +++ b/exercises/simple-linked-list/build.gradle @@ -10,3 +10,9 @@ dependencies { testCompile "junit:junit:4.10" testCompile "org.assertj:assertj-core:3.2.0" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/simple-linked-list/src/test/java/SimpleLinkedListTest.java b/exercises/simple-linked-list/src/test/java/SimpleLinkedListTest.java index 0732a6a39..3167b2c46 100644 --- a/exercises/simple-linked-list/src/test/java/SimpleLinkedListTest.java +++ b/exercises/simple-linked-list/src/test/java/SimpleLinkedListTest.java @@ -2,15 +2,18 @@ import java.util.NoSuchElementException; import static org.assertj.core.api.Assertions.assertThat; import org.junit.Test; +import org.junit.Ignore; public class SimpleLinkedListTest { + @Test public void aNewListIsEmpty() { SimpleLinkedList list = new SimpleLinkedList(); assertThat(list.size()).isEqualTo(0); } + @Ignore @Test public void canCreateFromArray() { Integer[] values = new Integer[]{1, 2, 3}; @@ -18,12 +21,14 @@ public void canCreateFromArray() { assertThat(list.size()).isEqualTo(3); } + @Ignore @Test(expected = NoSuchElementException.class) public void popOnEmptyListWillThrow() { SimpleLinkedList list = new SimpleLinkedList(); list.pop(); } + @Ignore @Test public void popReturnsLastAddedElement() { SimpleLinkedList list = new SimpleLinkedList(); @@ -35,6 +40,7 @@ public void popReturnsLastAddedElement() { assertThat(list.size()).isEqualTo(0); } + @Ignore @Test public void reverseReversesList() { SimpleLinkedList list = new SimpleLinkedList(); @@ -51,6 +57,7 @@ public void reverseReversesList() { assertThat(list.pop()).isEqualTo(5); } + @Ignore @Test public void canReturnListAsArray() { SimpleLinkedList list = new SimpleLinkedList(); @@ -63,6 +70,7 @@ public void canReturnListAsArray() { assertThat(list.asArray(Integer.class)).containsExactly(expected); } + @Ignore @Test public void canReturnEmptyListAsEmptyArray() { SimpleLinkedList list = new SimpleLinkedList(); diff --git a/exercises/space-age/build.gradle b/exercises/space-age/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/space-age/build.gradle +++ b/exercises/space-age/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/space-age/src/test/java/SpaceAgeTest.java b/exercises/space-age/src/test/java/SpaceAgeTest.java index 4bd71c743..13042d981 100644 --- a/exercises/space-age/src/test/java/SpaceAgeTest.java +++ b/exercises/space-age/src/test/java/SpaceAgeTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import static org.junit.Assert.assertEquals; @@ -6,6 +7,7 @@ public class SpaceAgeTest { private static final double MAXIMUM_DELTA = 1E-02; + @Test public void ageInSeconds() { SpaceAge age = new SpaceAge(1000000); @@ -13,6 +15,7 @@ public void ageInSeconds() { assertEquals(1000000, age.getSeconds(), MAXIMUM_DELTA); } + @Ignore @Test public void ageOnEarth() { SpaceAge age = new SpaceAge(1000000000); @@ -20,6 +23,7 @@ public void ageOnEarth() { assertEquals(31.69, age.onEarth(), MAXIMUM_DELTA); } + @Ignore @Test public void ageOnMercury() { SpaceAge age = new SpaceAge(2134835688); @@ -28,6 +32,7 @@ public void ageOnMercury() { assertEquals(280.88, age.onMercury(), MAXIMUM_DELTA); } + @Ignore @Test public void ageOnVenus() { SpaceAge age = new SpaceAge(189839836); @@ -36,6 +41,7 @@ public void ageOnVenus() { assertEquals(9.78, age.onVenus(), MAXIMUM_DELTA); } + @Ignore @Test public void ageOnMars() { SpaceAge age = new SpaceAge(2329871239L); @@ -44,6 +50,7 @@ public void ageOnMars() { assertEquals(39.25, age.onMars(), MAXIMUM_DELTA); } + @Ignore @Test public void ageOnJupiter() { SpaceAge age = new SpaceAge(901876382); @@ -52,6 +59,7 @@ public void ageOnJupiter() { assertEquals(2.41, age.onJupiter(), MAXIMUM_DELTA); } + @Ignore @Test public void ageOnSaturn() { SpaceAge age = new SpaceAge(3000000000L); @@ -60,6 +68,7 @@ public void ageOnSaturn() { assertEquals(3.23, age.onSaturn(), MAXIMUM_DELTA); } + @Ignore @Test public void ageOnUranus() { SpaceAge age = new SpaceAge(3210123456L); @@ -68,6 +77,7 @@ public void ageOnUranus() { assertEquals(1.21, age.onUranus(), MAXIMUM_DELTA); } + @Ignore @Test public void ageOnNeptune() { SpaceAge age = new SpaceAge(8210123456L); diff --git a/exercises/strain/build.gradle b/exercises/strain/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/strain/build.gradle +++ b/exercises/strain/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/strain/src/test/java/StrainTest.java b/exercises/strain/src/test/java/StrainTest.java index 25f73efd3..32c0ebcb2 100644 --- a/exercises/strain/src/test/java/StrainTest.java +++ b/exercises/strain/src/test/java/StrainTest.java @@ -1,5 +1,6 @@ import org.junit.Assert; import org.junit.Test; +import org.junit.Ignore; import java.util.Arrays; import java.util.LinkedList; @@ -7,6 +8,7 @@ public class StrainTest { + @Test public void emptyKeep() { List input = new LinkedList<>(); @@ -14,6 +16,7 @@ public void emptyKeep() { Assert.assertEquals(expectedOutput, Strain.keep(input, x -> x < 10)); } + @Ignore @Test public void keepEverything() { List input = Arrays.asList(1, 2, 3); @@ -21,6 +24,7 @@ public void keepEverything() { Assert.assertEquals(expectedOutput, Strain.keep(input, x -> x < 10)); } + @Ignore @Test public void keepFirstAndLast() { List input = Arrays.asList(1, 2, 3); @@ -28,6 +32,7 @@ public void keepFirstAndLast() { Assert.assertEquals(expectedOutput, Strain.keep(input, x -> x % 2 != 0)); } + @Ignore @Test public void keepNeitherFirstNorLast() { List input = Arrays.asList(1, 2, 3, 4, 5); @@ -35,6 +40,7 @@ public void keepNeitherFirstNorLast() { Assert.assertEquals(expectedOutput, Strain.keep(input, x -> x % 2 == 0)); } + @Ignore @Test public void KeepStrings() { List words = Arrays @@ -44,6 +50,7 @@ public void KeepStrings() { Strain.keep(words, x -> x.startsWith("z"))); } + @Ignore @Test public void KeepArrays() { List> actual = Arrays.asList( @@ -63,6 +70,7 @@ public void KeepArrays() { Strain.keep(actual, col -> col.contains(5))); } + @Ignore @Test public void emptyDiscard() { List input = new LinkedList<>(); @@ -70,6 +78,7 @@ public void emptyDiscard() { Assert.assertEquals(expectedOutput, Strain.discard(input, x -> x < 10)); } + @Ignore @Test public void discardNothing() { List input = Arrays.asList(1, 2, 3); @@ -77,6 +86,7 @@ public void discardNothing() { Assert.assertEquals(expectedOutput, Strain.discard(input, x -> x > 10)); } + @Ignore @Test public void discardFirstAndLast() { List input = Arrays.asList(1, 2, 3); @@ -85,6 +95,7 @@ public void discardFirstAndLast() { } + @Ignore @Test public void discardNeitherFirstNorLast() { List input = Arrays.asList(1, 2, 3, 4, 5); @@ -92,6 +103,7 @@ public void discardNeitherFirstNorLast() { Assert.assertEquals(expectedOutput, Strain.discard(input, x -> x % 2 == 0)); } + @Ignore @Test public void discardStrings() { List words = Arrays @@ -101,6 +113,7 @@ public void discardStrings() { Strain.discard(words, x -> x.startsWith("z"))); } + @Ignore @Test public void discardArrays() { List> actual = Arrays.asList( diff --git a/exercises/triangle/build.gradle b/exercises/triangle/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/triangle/build.gradle +++ b/exercises/triangle/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/triangle/src/test/java/TriangleTest.java b/exercises/triangle/src/test/java/TriangleTest.java index 759c5235f..6a271e2ad 100644 --- a/exercises/triangle/src/test/java/TriangleTest.java +++ b/exercises/triangle/src/test/java/TriangleTest.java @@ -1,9 +1,11 @@ import org.junit.Test; +import org.junit.Ignore; import static org.junit.Assert.assertEquals; public class TriangleTest { + @Test public void equilateralTriangleHaveEqualSides() throws Exception { Triangle triangle = new Triangle(2, 2, 2); @@ -11,6 +13,7 @@ public void equilateralTriangleHaveEqualSides() throws Exception { assertEquals(TriangleKind.EQUILATERAL, triangle.getKind()); } + @Ignore @Test public void largerEquilateralTrianglesAlsoHaveEqualSides() throws Exception { Triangle triangle = new Triangle(10, 10, 10); @@ -18,6 +21,7 @@ public void largerEquilateralTrianglesAlsoHaveEqualSides() throws Exception { assertEquals(TriangleKind.EQUILATERAL, triangle.getKind()); } + @Ignore @Test public void isoscelesTrianglesHaveLastTwoSidesEqual() throws Exception { Triangle triangle = new Triangle(3, 4, 4); @@ -25,6 +29,7 @@ public void isoscelesTrianglesHaveLastTwoSidesEqual() throws Exception { assertEquals(TriangleKind.ISOSCELES, triangle.getKind()); } + @Ignore @Test public void isoscelesTrianglesHaveFirstAndLastSidesEqual() throws Exception { Triangle triangle = new Triangle(4, 3, 4); @@ -32,6 +37,7 @@ public void isoscelesTrianglesHaveFirstAndLastSidesEqual() throws Exception { assertEquals(TriangleKind.ISOSCELES, triangle.getKind()); } + @Ignore @Test public void isoscelesTrianglesHaveTwoFirstSidesEqual() throws Exception { Triangle triangle = new Triangle(4, 4, 3); @@ -39,6 +45,7 @@ public void isoscelesTrianglesHaveTwoFirstSidesEqual() throws Exception { assertEquals(TriangleKind.ISOSCELES, triangle.getKind()); } + @Ignore @Test public void isoscelesTrianglesHaveInFactExactlyTwoSidesEqual() throws Exception { Triangle triangle = new Triangle(10, 10, 2); @@ -46,6 +53,7 @@ public void isoscelesTrianglesHaveInFactExactlyTwoSidesEqual() throws Exception assertEquals(TriangleKind.ISOSCELES, triangle.getKind()); } + @Ignore @Test public void scaleneTrianglesHaveNoEqualSides() throws Exception { Triangle triangle = new Triangle(3, 4, 5); @@ -53,6 +61,7 @@ public void scaleneTrianglesHaveNoEqualSides() throws Exception { assertEquals(TriangleKind.SCALENE, triangle.getKind()); } + @Ignore @Test public void scaleneTrianglesHaveNoEqualSidesAtLargerScaleEither() throws Exception { Triangle triangle = new Triangle(10, 11, 12); @@ -60,6 +69,7 @@ public void scaleneTrianglesHaveNoEqualSidesAtLargerScaleEither() throws Excepti assertEquals(TriangleKind.SCALENE, triangle.getKind()); } + @Ignore @Test public void scaleneTrianglesHaveNoEqualSidesInDescendingOrderEither() throws Exception { Triangle triangle = new Triangle(5, 4, 2); @@ -67,6 +77,7 @@ public void scaleneTrianglesHaveNoEqualSidesInDescendingOrderEither() throws Exc assertEquals(TriangleKind.SCALENE, triangle.getKind()); } + @Ignore @Test public void verySmallTrianglesAreLegal() throws Exception { Triangle triangle = new Triangle(0.4, 0.6, 0.3); @@ -74,26 +85,31 @@ public void verySmallTrianglesAreLegal() throws Exception { assertEquals(TriangleKind.SCALENE, triangle.getKind()); } + @Ignore @Test(expected = TriangleException.class) public void trianglesWithNoSizeAreIllegal() throws Exception { new Triangle(0, 0, 0); } + @Ignore @Test(expected = TriangleException.class) public void trianglesWithNegativeSidesAreIllegal() throws Exception { new Triangle(3, 4, -5); } + @Ignore @Test(expected = TriangleException.class) public void trianglesViolatingTriangleInequalityAreIllegal() throws Exception { new Triangle(1, 1, 3); } + @Ignore @Test(expected = TriangleException.class) public void trianglesViolatingTriangleInequalityAreIllegal2() throws Exception { new Triangle(2, 4, 2); } + @Ignore @Test(expected = TriangleException.class) public void trianglesViolatingTriangleInequalityAreIllegal3() throws Exception { new Triangle(7, 3, 2); diff --git a/exercises/trinary/build.gradle b/exercises/trinary/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/trinary/build.gradle +++ b/exercises/trinary/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/trinary/src/test/java/TrinaryTest.java b/exercises/trinary/src/test/java/TrinaryTest.java index 541e4d39e..4f4544b9e 100644 --- a/exercises/trinary/src/test/java/TrinaryTest.java +++ b/exercises/trinary/src/test/java/TrinaryTest.java @@ -1,23 +1,28 @@ import static org.junit.Assert.assertEquals; import org.junit.Test; +import org.junit.Ignore; public class TrinaryTest { + @Test public void testNonTrinaryCharacterIsZero() { assertEquals(0, Trinary.toDecimal("-")); } + @Ignore @Test public void testNonTrinaryNumberIsZero() { assertEquals(0, Trinary.toDecimal("3")); } + @Ignore @Test public void testTrinaryWithNonTrinaryIsZero() { assertEquals(0, Trinary.toDecimal("102-12")); } + @Ignore @Test public void testTrinary() { assertEquals(302, Trinary.toDecimal("102012")); diff --git a/exercises/word-count/build.gradle b/exercises/word-count/build.gradle index 9af8b0b86..51ed1ba84 100644 --- a/exercises/word-count/build.gradle +++ b/exercises/word-count/build.gradle @@ -9,3 +9,9 @@ repositories { dependencies { testCompile "junit:junit:4.10" } +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} diff --git a/exercises/word-count/src/test/java/WordCountTest.java b/exercises/word-count/src/test/java/WordCountTest.java index f40922e99..5f4a92f0b 100644 --- a/exercises/word-count/src/test/java/WordCountTest.java +++ b/exercises/word-count/src/test/java/WordCountTest.java @@ -1,4 +1,5 @@ import org.junit.Test; +import org.junit.Ignore; import java.lang.Integer; import java.lang.String; @@ -11,6 +12,7 @@ public class WordCountTest { private final WordCount wordCount = new WordCount(); + @Test public void countOneWord() { Map actualWordCount = new HashMap(); @@ -23,6 +25,7 @@ public void countOneWord() { ); } + @Ignore @Test public void countOneOfEach() { Map actualWordCount = new HashMap(); @@ -37,6 +40,7 @@ public void countOneOfEach() { ); } + @Ignore @Test public void countMultipleOccurences() { Map actualWordCount = new HashMap(); @@ -53,6 +57,7 @@ public void countMultipleOccurences() { ); } + @Ignore @Test public void ignorePunctuation() { Map actualWordCount = new HashMap(); @@ -70,6 +75,7 @@ public void ignorePunctuation() { } + @Ignore @Test public void includeNumbers() { Map actualWordCount = new HashMap(); @@ -84,6 +90,7 @@ public void includeNumbers() { ); } + @Ignore @Test public void normalizeCase() { Map actualWordCount = new HashMap(); diff --git a/scripts/increase-test-logging.sh b/scripts/increase-test-logging.sh new file mode 100755 index 000000000..c0a92f3d9 --- /dev/null +++ b/scripts/increase-test-logging.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +LOGGING_CHUNK_FILE=/tmp/test-logging.gradle + +cat <<-EOF > $LOGGING_CHUNK_FILE +test { + testLogging { + exceptionFormat = 'full' + events = ["passed", "failed", "skipped"] + } +} +EOF + +for file in `find . -name "build.gradle"`; do + tempfile="/tmp/increase-test-logging.tmp" + + echo -e "\n\n\n*** $file ******************************" + cat $file $LOGGING_CHUNK_FILE > "$tempfile" + mv "$tempfile" "$file" +done + diff --git a/scripts/insert-ignores.sh b/scripts/insert-ignores.sh new file mode 100755 index 000000000..7e5b4b986 --- /dev/null +++ b/scripts/insert-ignores.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +for file in `find . -name "*Test.java"`; do + tempfile="/tmp/insert-ignores.tmp" + + echo -e "\n\n\n*** $file ******************************" + cat $file | \ + sed 's/import org.junit.Test;/import org.junit.Test;\ +import org.junit.Ignore;/' | \ + sed 's/@Test/@Ignore\ + @Test/' | \ + sed '1,/@Ignore/s/.*@Ignore//' > "$tempfile" \ + && mv "$tempfile" "$file" +done + From 13a7d1b7e45f2e7fc2ebaa006359612012ed9b83 Mon Sep 17 00:00:00 2001 From: "John S. Ryan" Date: Sun, 25 Sep 2016 07:50:50 -0700 Subject: [PATCH 4/4] (minor) Fix indentation. --- .../grade-school/src/test/java/SchoolTest.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/exercises/grade-school/src/test/java/SchoolTest.java b/exercises/grade-school/src/test/java/SchoolTest.java index 68a4bd825..a7ea98f08 100644 --- a/exercises/grade-school/src/test/java/SchoolTest.java +++ b/exercises/grade-school/src/test/java/SchoolTest.java @@ -12,20 +12,20 @@ public class SchoolTest { private final School school = new School(); - @Test + @Test public void startsWithNoStudents() { assertThat(school.db()).isEmpty(); } @Ignore - @Test + @Test public void addsStudents() { school.add("Aimee", 2); assertThat(school.db().get(2)).contains("Aimee"); } @Ignore - @Test + @Test public void addsMoreStudentsInSameGrade() { final int grade = 2; school.add("James", grade); @@ -36,7 +36,7 @@ public void addsMoreStudentsInSameGrade() { } @Ignore - @Test + @Test public void addsStudentsInMultipleGrades() { school.add("Chelsea", 3); school.add("Logan", 7); @@ -47,7 +47,7 @@ public void addsStudentsInMultipleGrades() { } @Ignore - @Test + @Test public void getsStudentsInAGrade() { school.add("Franklin", 5); school.add("Bradley", 5); @@ -56,13 +56,13 @@ public void getsStudentsInAGrade() { } @Ignore - @Test + @Test public void getsStudentsInEmptyGrade() { assertThat(school.grade(1)).isEmpty(); } @Ignore - @Test + @Test public void sortsSchool() { school.add("Jennifer", 4); school.add("Kareem", 6);