Kaynağa Gözat

Merge branch 'master' into poker

Mehdi El Houti 9 yıl önce
ebeveyn
işleme
eba02913db
100 değiştirilmiş dosya ile 1486 ekleme ve 813 silme
  1. 0
    0
      .Rhistory
  2. 10
    0
      .gitattributes
  3. 10
    0
      .github/PULL_REQUEST_TEMPLATE.md
  4. 0
    1
      .gitignore
  5. 23
    9
      .travis.yml
  6. 2
    2
      LICENSE
  7. 71
    0
      POLICIES.md
  8. 13
    20
      README.md
  9. 1
    0
      _template/build.gradle
  10. 0
    0
      _template/src/example/java/.keep
  11. 0
    0
      _template/src/main/java/.keep
  12. 0
    0
      _template/src/test/java/.keep
  13. 1
    1
      bin/fetch-configlet
  14. 35
    24
      bin/journey-test.sh
  15. 3
    3
      bin/unit-tests.sh
  16. 249
    96
      config.json
  17. 0
    0
      docs/EXERCISE_README_INSERT.md
  18. 2
    2
      docs/INSTALLATION.md
  19. 4
    21
      docs/MAINTAINING.md
  20. 3
    3
      docs/TESTS.md
  21. 0
    0
      exercises/_template/src/example/java/.keep
  22. 0
    0
      exercises/_template/src/main/java/.keep
  23. 0
    0
      exercises/_template/src/test/java/.keep
  24. 1
    0
      exercises/accumulate/build.gradle
  25. 4
    4
      exercises/accumulate/src/test/java/AccumulateTest.java
  26. 1
    0
      exercises/acronym/build.gradle
  27. 15
    3
      exercises/acronym/src/example/java/Acronym.java
  28. 11
    0
      exercises/acronym/src/main/java/Acronym.java
  29. 14
    28
      exercises/acronym/src/test/java/AcronymTest.java
  30. 1
    0
      exercises/all-your-base/build.gradle
  31. 1
    1
      exercises/all-your-base/src/main/java/BaseConverter.java
  32. 43
    40
      exercises/all-your-base/src/test/java/BaseConverterTest.java
  33. 1
    0
      exercises/allergies/build.gradle
  34. 18
    18
      exercises/allergies/src/test/java/AllergiesTest.java
  35. 1
    0
      exercises/anagram/build.gradle
  36. 15
    15
      exercises/anagram/src/test/java/AnagramTest.java
  37. 1
    0
      exercises/atbash-cipher/build.gradle
  38. 5
    5
      exercises/atbash-cipher/src/example/java/Atbash.java
  39. 19
    19
      exercises/atbash-cipher/src/test/java/AtbashTest.java
  40. 1
    0
      exercises/beer-song/build.gradle
  41. 4
    7
      exercises/beer-song/src/example/java/BeerSong.java
  42. 21
    13
      exercises/beer-song/src/test/java/BeerSongTest.java
  43. 41
    41
      exercises/binary-search-tree/src/test/java/BSTTest.java
  44. 1
    0
      exercises/binary-search/build.gradle
  45. 79
    87
      exercises/binary-search/src/test/java/BinarySearchTest.java
  46. 1
    0
      exercises/binary/build.gradle
  47. 1
    0
      exercises/bob/build.gradle
  48. 17
    17
      exercises/bob/src/test/java/BobTest.java
  49. 18
    0
      exercises/book-store/build.gradle
  50. 0
    0
      exercises/book-store/src/example/java/.keep
  51. 50
    0
      exercises/book-store/src/example/java/BookStore.java
  52. 0
    0
      exercises/book-store/src/main/java/.keep
  53. 0
    0
      exercises/book-store/src/test/java/.keep
  54. 113
    0
      exercises/book-store/src/test/java/BookStoreTest.java
  55. 1
    0
      exercises/bracket-push/build.gradle
  56. 1
    1
      exercises/bracket-push/src/main/java/BracketChecker.java
  57. 13
    13
      exercises/bracket-push/src/test/java/BracketCheckerTest.java
  58. 57
    31
      exercises/build.gradle
  59. 1
    0
      exercises/change/build.gradle
  60. 1
    1
      exercises/change/src/main/java/ChangeCalculator.java
  61. 9
    9
      exercises/change/src/test/java/ChangeCalculatorTest.java
  62. 3
    0
      exercises/clock/HINT.md
  63. 2
    1
      exercises/clock/build.gradle
  64. 19
    16
      exercises/clock/src/test/java/ClockAddTest.java
  65. 21
    18
      exercises/clock/src/test/java/ClockCreationTest.java
  66. 36
    32
      exercises/clock/src/test/java/ClockEqualTest.java
  67. 18
    0
      exercises/collatz-conjecture/build.gradle
  68. 19
    0
      exercises/collatz-conjecture/src/example/java/CollatzCalculator.java
  69. 7
    0
      exercises/collatz-conjecture/src/main/java/CollatzCalculator.java
  70. 65
    0
      exercises/collatz-conjecture/src/test/java/CollatzCalculatorTest.java
  71. 1
    0
      exercises/crypto-square/build.gradle
  72. 14
    14
      exercises/crypto-square/src/test/java/CryptoSquareTest.java
  73. 36
    36
      exercises/custom-set/src/test/java/CustomSetTest.java
  74. 1
    0
      exercises/diamond/build.gradle
  75. 4
    4
      exercises/diamond/src/example/java/DiamondPrinter.java
  76. 1
    1
      exercises/diamond/src/main/java/DiamondPrinter.java
  77. 21
    10
      exercises/diamond/src/test/java/DiamondPrinterTest.java
  78. 1
    0
      exercises/difference-of-squares/build.gradle
  79. 4
    4
      exercises/difference-of-squares/src/example/java/DifferenceOfSquaresCalculator.java
  80. 0
    0
      exercises/difference-of-squares/src/main/java/.keep
  81. 0
    5
      exercises/difference-of-squares/src/main/java/Difference.java
  82. 90
    0
      exercises/difference-of-squares/src/test/java/DifferenceOfSquaresCalculatorTest.java
  83. 0
    87
      exercises/difference-of-squares/src/test/java/DifferenceTest.java
  84. 1
    0
      exercises/etl/build.gradle
  85. 3
    3
      exercises/etl/src/test/java/EtlTest.java
  86. 1
    0
      exercises/flatten-array/build.gradle
  87. 1
    1
      exercises/flatten-array/src/main/java/Flattener.java
  88. 20
    5
      exercises/flatten-array/src/test/java/FlattenerTest.java
  89. 1
    0
      exercises/gigasecond/build.gradle
  90. 7
    6
      exercises/gigasecond/src/example/java/Gigasecond.java
  91. 18
    0
      exercises/gigasecond/src/main/java/Gigasecond.java
  92. 4
    5
      exercises/gigasecond/src/test/java/GigasecondTest.java
  93. 1
    0
      exercises/grade-school/build.gradle
  94. 15
    9
      exercises/grade-school/src/test/java/SchoolTest.java
  95. 1
    0
      exercises/hamming/build.gradle
  96. 11
    2
      exercises/hamming/src/example/java/Hamming.java
  97. 9
    0
      exercises/hamming/src/main/java/Hamming.java
  98. 17
    18
      exercises/hamming/src/test/java/HammingTest.java
  99. 5
    1
      exercises/hello-world/GETTING_STARTED.md
  100. 0
    0
      exercises/hello-world/HINT.md

exercises/space-age/src/main/java/.keep → .Rhistory Dosyayı Görüntüle


+ 10
- 0
.gitattributes Dosyayı Görüntüle

@@ -0,0 +1,10 @@
1
+# Autodetect text files
2
+* text=auto
3
+
4
+# Force the following filetypes to have unix eols, so Windows does not break them
5
+*.* text eol=lf
6
+
7
+# Force images/fonts to be handled as binaries
8
+*.jpg binary
9
+*.jpeg binary
10
+*.png binary

+ 10
- 0
.github/PULL_REQUEST_TEMPLATE.md Dosyayı Görüntüle

@@ -0,0 +1,10 @@
1
+<!-- Your content goes here: -->
2
+
3
+
4
+
5
+<!-- DO NOT EDIT BELOW THIS LINE! -->
6
+---
7
+
8
+Reviewer Resources:
9
+
10
+[Track Policies](https://github.com/exercism/xjava/blob/master/POLICIES.md#event-checklist)

+ 0
- 1
.gitignore Dosyayı Görüntüle

@@ -8,5 +8,4 @@ build/
8 8
 *.iml
9 9
 bin/configlet
10 10
 bin/configlet.exe
11
-gradle/
12 11
 /exercises/.nb-gradle/

+ 23
- 9
.travis.yml Dosyayı Görüntüle

@@ -3,17 +3,9 @@ language: java
3 3
 jdk:
4 4
   - oraclejdk8
5 5
 
6
-notifications:
7
-  webhooks:
8
-    urls:
9
-      - https://webhooks.gitter.im/e/5e9ccd41111917b19478
10
-    on_success: change  # options: [always|never|change] default: always
11
-    on_failure: always  # options: [always|never|change] default: always
12
-    on_start: never     # options: [always|never|change] default: always
13
-
14 6
 # http://docs.travis-ci.com/user/migrating-from-legacy
15 7
 sudo: false
16
-cache: bundler
8
+
17 9
 addons:
18 10
   apt:
19 11
     packages:
@@ -24,9 +16,31 @@ before_install:
24 16
   - rvm use 2.2.5
25 17
   - bin/build-jq.sh  # we want jq 1.5 features; not avail through pkg repo.
26 18
 
19
+# https://docs.travis-ci.com/user/customizing-the-build#Skipping-the-Installation-Step
20
+install: true  # if we don't skip install, ./gradlew assemble is invoked, but this task is not available.
21
+
27 22
 before_script:
28 23
   - export PATH=$TRAVIS_BUILD_DIR/bin:$PATH  # ensure our tools are prefered over included ones.
29 24
 
30 25
 script:
31 26
   - bin/unit-tests.sh
32 27
   - bin/journey-test.sh
28
+
29
+# configure caching (https://docs.travis-ci.com/user/languages/java/#Caching)
30
+before_cache:
31
+  - rm -f  $HOME/.gradle/caches/modules-2/modules-2.lock
32
+  - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
33
+# format from https://docs.travis-ci.com/user/caching/#Enabling-multiple-caching-features
34
+cache:
35
+  bundler: true
36
+  directories:
37
+    - $HOME/.gradle/caches/
38
+    - $HOME/.gradle/wrapper/
39
+
40
+notifications:
41
+  webhooks:
42
+    urls:
43
+      - https://webhooks.gitter.im/e/5e9ccd41111917b19478
44
+    on_success: change  # options: [always|never|change] default: always
45
+    on_failure: always  # options: [always|never|change] default: always
46
+    on_start: never     # options: [always|never|change] default: always

+ 2
- 2
LICENSE Dosyayı Görüntüle

@@ -1,6 +1,6 @@
1
-The MIT License (MIT)
1
+MIT License
2 2
 
3
-Copyright (c) 2014 Katrina Owen, _@kytrinyx.com
3
+Copyright (c) 2017 Exercism, Inc
4 4
 
5 5
 Permission is hereby granted, free of charge, to any person obtaining a copy
6 6
 of this software and associated documentation files (the "Software"), to deal

+ 71
- 0
POLICIES.md Dosyayı Görüntüle

@@ -0,0 +1,71 @@
1
+# Track Policies
2
+
3
+This document:
4
+
5
+- describes all current track-wide policies; and
6
+- lists all policies that should be reviewed in response to any given track event.
7
+
8
+Maintainers should refer to this document each time they review a pull request.
9
+
10
+Our policies are not set-in-stone. They represent directions chosen at a point in time with the information/context available at that time. We actively encourage contributors to review and critique them. If you have read through the references that informed an existing policy and still feel it should be improved or removed, please comment and describe:
11
+
12
+1. your alternative perspective;
13
+2. your proposed changes; and
14
+3. how your proposal balances your own perspective with those already raised during prior discussions.
15
+
16
+## Event Checklist
17
+
18
+| Track Event | Policies to review |
19
+|:------------|:-----------------|
20
+| Exercise added | [Prefer instance methods](#prefer-instance-methods); [Starter implementations](#starter-implementations); [Ignore noninitial tests](#ignore-noninitial-tests) |
21
+| Exercise updated | [Ignore noninitial tests](#ignore-noninitial-tests); [Multiple file submissions](#multiple-file-submissions) |
22
+| Track order changed | [Starter implementations](#starter-implementations); [Multiple file submissions](#multiple-file-submissions) |
23
+| New issue observed in track | [Good first patches](#good-first-patches) |
24
+| "Good first patch" issue completed | [Good first patches](#good-first-patches) |
25
+| Installing Java instructions updated | [Simple onboarding](#simple-onboarding) |
26
+
27
+## Policy Descriptions
28
+
29
+### Prefer instance methods
30
+
31
+> Most (all?) exercises should be implemented in the form of instance methods since they contain "domain logic" and we (Exercism) want to encourage exemplary software.
32
+
33
+References: [[1](https://github.com/exercism/java/issues/177#issuecomment-261291741)]
34
+
35
+### Starter implementations
36
+
37
+> - Exercises 1-10: provide stubs for all required constructors and methods. Stubs should include the following body:
38
+    `throw new UnsupportedOperationException("Delete this statement and write your own implementation.");`
39
+> - Exercises 11-20: provide stubs for all constructors and methods required by the first test; comment-out the bodies of any tests that require non-stubbed constructors or methods. Stubs should include the following body:
40
+    `throw new UnsupportedOperationException("Delete this statement and provide your own implementation.");`
41
+> - Exercises 21+: provide no stubs, but mention any "interesting" interface aspects in the HINT.md file (which gets merged into the README.md for the exercise).
42
+
43
+References: [[1](https://github.com/exercism/java/issues/178)]
44
+
45
+### Do not make user-facing classes `final`
46
+
47
+> Starter implementations and test classes should not include the `final` keyword in class declarations as it isn't strictly necessary and could be confusing to people unfamiliar with Java.
48
+
49
+### Ignore noninitial tests
50
+
51
+> All but the first test in an exercise test suite should be annotated `@Ignore("Remove to run test")` (single test) or `@Ignore("Remove to run tests")` (parametrized test).
52
+
53
+References: [[1](https://github.com/exercism/java/issues/101#issuecomment-249349204)]
54
+
55
+### Multiple file submissions
56
+
57
+> The first exercise in the track whose test suite mandates multiple solution files should be accompanied by a HINT.md file reminding the practitioner that the CLI supports multiple file submissions.
58
+
59
+References: [[1](https://github.com/exercism/java/issues/365#issuecomment-292533120)]
60
+
61
+### Good first patches
62
+
63
+> Aim to keep 10-20 small and straightforward issues open at eny given time. Identify any such issues by applying the "Good first patch" label. You can view the current list of these issues [here](https://github.com/exercism/java/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+patch%22).
64
+
65
+References: [[1](https://github.com/exercism/java/issues/220#issue-196447088)]
66
+
67
+### Simple onboarding
68
+
69
+> The Installing Java instructions should seek to minimize the number of steps and the number of concepts a new-to-the-track practitioner needs to learn to get to coding.
70
+
71
+References: [[1](https://github.com/exercism/java/issues/395#issue-215734887)]

+ 13
- 20
README.md Dosyayı Görüntüle

@@ -1,10 +1,10 @@
1
-# xJava [![Build Status](https://travis-ci.org/exercism/xjava.svg?branch=master)](https://travis-ci.org/exercism/xjava) [![Join the chat at https://gitter.im/exercism/xjava](https://badges.gitter.im/exercism/xjava.svg)](https://gitter.im/exercism/xjava?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
1
+# java [![Build Status](https://travis-ci.org/exercism/java.svg?branch=master)](https://travis-ci.org/exercism/java) [![Join the chat at https://gitter.im/exercism/xjava](https://badges.gitter.im/exercism/java.svg)](https://gitter.im/exercism/xjava?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
2 2
 
3 3
 Source for Exercism Exercises in Java.
4 4
 
5 5
 ## Contributing Guide
6 6
 
7
-For general information about how to contribute to Exercism, please refer to the [Contributing Guide](https://github.com/exercism/x-api/blob/master/CONTRIBUTING.md#the-exercise-data).
7
+For general information about how to contribute to Exercism, please refer to the [Contributing Guide](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks).
8 8
 
9 9
 ## Table of Contents
10 10
 
@@ -32,13 +32,13 @@ To submit a fix for an existing exercise or port an exercise to Java with the le
32 32
 1. **Ensure you have the basic Java tooling installed:**  JDK 1.8+, an editor and Gradle 2.x.
33 33
 
34 34
    (see [exercism.io: Installing Java](http://exercism.io/languages/java/installing))
35
--  **Setup a branch on a fork of [exercism/xjava](https://github.com/exercism/xjava) on your computer.**
35
+-  **Setup a branch on a fork of [exercism/java](https://github.com/exercism/java) on your computer.**
36 36
 
37
-   See [GitHub Help: Forking](https://help.github.com/articles/fork-a-repo/).  Use those instructions (in conjunction with [Exercism Contributing Guide](https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md#git-basics)) to:
37
+   See [GitHub Help: Forking](https://help.github.com/articles/fork-a-repo/).  Use those instructions (in conjunction with the [Git Basics doc](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/git-basics.md)) to:
38 38
    * "fork" a repository on GitHub;
39 39
    - install `git`;
40 40
    - "clone" a copy of your fork;
41
-   - configure an "upstream remote" (in this case, `exercism/xjava`);
41
+   - configure an "upstream remote" (in this case, `exercism/java`);
42 42
    - create a branch to house your work
43 43
 -  **Write the codes.**  Do your work on that branch you just created.
44 44
 
@@ -52,15 +52,15 @@ To submit a fix for an existing exercise or port an exercise to Java with the le
52 52
    $ git push
53 53
    ```
54 54
 
55
-   [Exercism Contributing Guide :: Commit Messages](https://github.com/exercism/x-common/blob/master/CONTRIBUTING.md#commit-messages) provides practical advice on crafting meaningful commit messages.
55
+   The Git Basics doc has a section on [commit messages](https://github.com/exercism/docs/blob/master/contributing-to-language-tracks/git-basics.md#commit-messages) that provides practical advice on crafting meaningful commit messages.
56 56
 -  **Verify that your work passes all tests.**  When you create a pull request (PR), GitHub triggers a build on Travis CI.  Your PR will not be merged unless those tests pass.
57 57
 
58 58
 ## Getting Familiar With the Codebase
59 59
 
60 60
 There are two objectives to the design of this build:
61 61
 
62
-1. when a problem is built from within the xjava repo, the tests run against the "example" code (i.e. when you, the contributor, are developing the exercise);
63
-2. when a problem is built outside the xjava repo (when a participant is solving the exercise), the tests run against the "main" code.
62
+1. when a problem is built from within the `exercism/java` repo (i.e. when you, the contributor, are developing the exercise), the tests run against the "example" code;
63
+2. when a problem is built outside the `exercism/java` repo (when a participant is solving the exercise), the tests run against the "main" code.
64 64
 
65 65
 This repo is a multi-project gradle build.
66 66
 
@@ -68,15 +68,15 @@ This repo is a multi-project gradle build.
68 68
 
69 69
 This is the top-level module, contained in the `exercises` directory.  It is a container for the problem sub-modules.
70 70
 
71
-  * it's `build.gradle` points the "main" sourceset to the example code.
72
-  * it's `settings.gradle` names each of the subprojects, one for each problem in the set.
71
+  * its `build.gradle` points the "main" sourceset to the example code.
72
+  * its `settings.gradle` names each of the subprojects, one for each problem in the set.
73 73
 
74 74
 ### The Problem Submodules
75 75
 
76 76
 The `exercises` subdirectory contains all of the problem submodules.
77 77
 Each problem/submodule is a subdirectory of the same name as its slug.
78 78
 
79
-  * it's `build.gradle` names dependencies required to work that problem.
79
+  * its `build.gradle` names dependencies required to work that problem.
80 80
 
81 81
 Each problem/submodule has three source sets:
82 82
 
@@ -109,18 +109,11 @@ and if you review the logs of your x-api, you'll find:
109 109
 2015-09-06 15:21:01 - JSON::GeneratorError - source sequence is illegal/malformed utf-8:
110 110
 ```
111 111
 
112
-This is because some files generated by the build can't be served from the x-api.  This is by design: the CLI does not serve binaries.  To fix this, simply make sure you do a clean in your `xjava` repo before you fetch:
112
+This is because some files generated by the build can't be served from the x-api.  This is by design: the CLI does not serve binaries.  To fix this, simply make sure you do a clean in your `exercism/java` repo before you fetch:
113 113
 
114 114
 ```
115
-cd ~/workspace/exercism/xjava/exercises
115
+cd ~/workspace/exercism/java/exercises
116 116
 gradle clean
117 117
 cd ~/workspace/exercism/exercises
118 118
 exercism fetch java bob
119 119
 ```
120
-
121
-
122
-# License
123
-
124
-The MIT License (MIT)
125
-
126
-Copyright (c) 2014 Katrina Owen, _@kytrinyx.com

exercises/_template/build.gradle → _template/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

exercises/scrabble-score/src/main/java/.keep → _template/src/example/java/.keep Dosyayı Görüntüle


exercises/raindrops/src/main/java/.keep → _template/src/main/java/.keep Dosyayı Görüntüle


exercises/luhn/src/main/java/.keep → _template/src/test/java/.keep Dosyayı Görüntüle


+ 1
- 1
bin/fetch-configlet Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-#!/bin/bash
1
+#!/usr/bin/env bash
2 2
 
3 3
 LATEST=https://github.com/exercism/configlet/releases/latest
4 4
 

+ 35
- 24
bin/journey-test.sh Dosyayı Görüntüle

@@ -1,5 +1,11 @@
1 1
 #!/usr/bin/env bash
2 2
 
3
+# This script is shared between the Java and Kotlin tracks.  If you make an update to this script on
4
+# one track, please create a companion PR to merge it in to the other.  Thank you!
5
+TRACK=java
6
+TRACK_REPO="$TRACK"
7
+TRACK_SRC_EXT="java"
8
+
3 9
 on_exit() {
4 10
   echo ">>> on_exit()"
5 11
   if [[ "$xapi_pid" != "" ]] ; then
@@ -16,7 +22,7 @@ assert_installed() {
16 22
 
17 23
   if [[ "`which $binary`" == "" ]]; then
18 24
     echo "${binary} not found; it is required to perform this test."
19
-    echo -e "Have you completed the setup instructions at https://github.com/exercism/xjava ?\n"
25
+    echo -e "Have you completed the setup instructions at https://github.com/exercism/${TRACK_REPO} ?\n"
20 26
     echo "PATH=${PATH}"
21 27
     echo "aborting."
22 28
     exit 1
@@ -35,7 +41,7 @@ assert_ruby_installed() {
35 41
   if [[ "${expected_ruby_ver}" != "" && "${current_ruby_ver}" != "${expected_ruby_ver}" ]]; then
36 42
     echo "${ruby_app_home} requires Ruby ${expected_ruby_ver}; current Ruby version is ${current_ruby_ver}."
37 43
     echo -e "Ruby used: `which ruby`.\n"
38
-    echo -e "Have you completed the setup instructions at https://github.com/exercism/xjava ?\n"
44
+    echo -e "Have you completed the setup instructions at https://github.com/exercism/${TRACK_REPO} ?\n"
39 45
     echo "PATH=${PATH}"
40 46
     echo "aborting."
41 47
     exit 1
@@ -59,7 +65,7 @@ clean() {
59 65
     rm -rf "${build_path}"
60 66
   fi
61 67
   cd exercises
62
-  gradle clean
68
+  "$EXECPATH"/gradlew clean
63 69
   cd ..
64 70
   echo "<<< clean()"
65 71
 }
@@ -141,20 +147,21 @@ make_local_trackler() {
141 147
   local xapi_home="$2"
142 148
   echo ">>> make_local_trackler(trackler=\"${trackler}\", xapi_home=\"${xapi_home}\")"
143 149
 
144
-  local xjava=$( pwd )
150
+  local track_root=$( pwd )
145 151
   pushd ${trackler}
152
+
153
+  # Get the version of Trackler x-api is currently using
154
+  local version=$( grep -m 1 'trackler' ${xapi_home}/Gemfile.lock | sed 's/.*(//' | sed 's/)//' )
155
+
156
+  git checkout v${version}
146 157
   git submodule init -- common
147 158
   git submodule update
148 159
 
149
-  # Bake in local copy of xjava; this is what we are testing.
150
-  rmdir tracks/java
151
-  mkdir -p tracks/java/exercises
152
-  cp ${xjava}/config.json tracks/java
153
-  cp -r ${xjava}/exercises tracks/java
154
-
155
-  # Set the version to that expected by x-api
156
-  version=$( grep -m 1 'trackler' ${xapi_home}/Gemfile.lock | sed 's/.*(//' | sed 's/)//' )
157
-  echo "module Trackler VERSION = \"${version}\" end" > lib/trackler/version.rb
160
+  # Bake in local copy of this track; this is what we are testing.
161
+  rmdir tracks/${TRACK}
162
+  mkdir -p tracks/${TRACK}/exercises
163
+  cp ${track_root}/config.json tracks/${TRACK}
164
+  cp -r ${track_root}/exercises tracks/${TRACK}
158 165
 
159 166
   gem install bundler
160 167
   bundle install
@@ -207,7 +214,7 @@ solve_all_exercises() {
207 214
   local exercism_configfile="$2"
208 215
   echo ">>> solve_all_exercises(exercism_exercises_dir=\"${exercism_exercises_dir}\", exercism_configfile=\"${exercism_configfile}\")"
209 216
 
210
-  local xjava=$( pwd )
217
+  local track_root=$( pwd )
211 218
   local exercism_cli="./exercism --config ${exercism_configfile}"
212 219
   local exercises=`cat config.json | jq '.exercises[].slug + " "' --join-output`
213 220
   local total_exercises=`cat config.json | jq '.exercises | length'`
@@ -221,15 +228,20 @@ solve_all_exercises() {
221 228
     echo "${current_exercise_number} of ${total_exercises} -- ${exercise}"
222 229
     echo "=================================================="
223 230
 
224
-    ${exercism_cli} fetch java $exercise
225
-    cp -R -H ${xjava}/exercises/${exercise}/src/example/java/* ${exercism_exercises_dir}/java/${exercise}/src/main/java/
231
+    ${exercism_cli} fetch ${TRACK} $exercise
232
+    cp -R -H ${track_root}/exercises/${exercise}/src/example/${TRACK}/* ${exercism_exercises_dir}/${TRACK}/${exercise}/src/main/${TRACK}/
226 233
 
227
-    pushd ${exercism_exercises_dir}/java/${exercise}
234
+    pushd ${exercism_exercises_dir}/${TRACK}/${exercise}
235
+    # Check that tests compile before we strip @Ignore annotations
236
+    "$EXECPATH"/gradlew compileTestJava
228 237
     # Ensure we run all the tests (as delivered, all but the first is @Ignore'd)
229
-    for testfile in `find . -name "*Test.java"`; do
230
-      sed 's/@Ignore//' ${testfile} > "${tempfile}" && mv "${tempfile}" "${testfile}"
238
+    for testfile in `find . -name "*Test.${TRACK_SRC_EXT}"`; do
239
+      # Strip @Ignore annotations to ensure we run the tests (as delivered, all but the first is @Ignore'd).
240
+      # Note that unit-test.sh also strips @Ignore annotations via the Gradle task copyTestsFilteringIgnores.
241
+      # The stripping implementations here and in copyTestsFilteringIgnores should be kept consistent.
242
+      sed 's/@Ignore\(\(.*\)\)\{0,1\}//' ${testfile} > "${tempfile}" && mv "${tempfile}" "${testfile}"
231 243
     done
232
-    gradle test
244
+    "$EXECPATH"/gradlew test
233 245
     popd
234 246
 
235 247
     current_exercise_number=$((current_exercise_number + 1))
@@ -241,9 +253,9 @@ main() {
241 253
   # all functions assume current working directory is repository root.
242 254
   cd "${SCRIPTPATH}/.."
243 255
 
244
-  local xjava=$( pwd )
256
+  local track_root=$( pwd )
245 257
   local build_dir="build"
246
-  local build_path="${xjava}/${build_dir}"
258
+  local build_path="${track_root}/${build_dir}"
247 259
 
248 260
   local xapi_home="${build_path}/x-api"
249 261
   local trackler_home="${build_path}/trackler"
@@ -253,12 +265,11 @@ main() {
253 265
   local xapi_port=9292
254 266
 
255 267
   # fail fast if required binaries are not installed.
256
-  assert_installed "gradle"
257 268
   assert_installed "jq"
258 269
 
259 270
   clean "${build_dir}"
260 271
 
261
-  # Make a version of trackler that includes the source from this repo.
272
+  # Make a local version of trackler that includes the source from this repo.
262 273
   git_clone "x-api" "${xapi_home}"
263 274
   git_clone "trackler" "${trackler_home}"
264 275
   assert_ruby_installed "${trackler_home}"

+ 3
- 3
bin/unit-tests.sh Dosyayı Görüntüle

@@ -1,6 +1,6 @@
1
-#!/bin/bash
1
+#!/usr/bin/env bash
2 2
 set -e
3
-gradle --version
3
+./gradlew --version
4 4
 
5 5
 echo ""
6 6
 echo ">>> Running configlet..."
@@ -10,6 +10,6 @@ bin/configlet .
10 10
 pushd exercises
11 11
 echo ""
12 12
 echo ">>> Running tests..."
13
-TERM=dumb gradle check compileStarterSourceJava --continue
13
+TERM=dumb ../gradlew check compileStarterSourceJava --parallel --continue
14 14
 popd
15 15
 

+ 249
- 96
config.json Dosyayı Görüntüle

@@ -1,273 +1,407 @@
1 1
 {
2 2
   "slug": "java",
3 3
   "language": "Java",
4
-  "repository": "https://github.com/exercism/xjava",
4
+  "repository": "https://github.com/exercism/java",
5 5
   "active": true,
6 6
   "exercises": [
7 7
     {
8 8
       "slug": "hello-world",
9 9
       "difficulty": 1,
10
-      "topics": []
10
+      "topics": [
11
+
12
+      ]
11 13
     },
12 14
     {
13 15
       "slug": "rna-transcription",
14 16
       "difficulty": 2,
15
-      "topics": []
17
+      "topics": [
18
+
19
+      ]
16 20
     },
17 21
     {
18 22
       "slug": "pangram",
19 23
       "difficulty": 3,
20
-      "topics": []
24
+      "topics": [
25
+
26
+      ]
21 27
     },
22 28
     {
23 29
       "slug": "hamming",
24 30
       "difficulty": 3,
25
-      "topics": []
31
+      "topics": [
32
+
33
+      ]
26 34
     },
27 35
     {
28 36
       "slug": "gigasecond",
29 37
       "difficulty": 3,
30
-      "topics": []
38
+      "topics": [
39
+
40
+      ]
31 41
     },
32 42
     {
33 43
       "slug": "space-age",
34 44
       "difficulty": 3,
35
-      "topics": []
45
+      "topics": [
46
+
47
+      ]
36 48
     },
37 49
     {
38 50
       "slug": "acronym",
39 51
       "difficulty": 3,
40
-      "topics": []
52
+      "topics": [
53
+
54
+      ]
41 55
     },
42 56
     {
43 57
       "slug": "scrabble-score",
44 58
       "difficulty": 3,
45
-      "topics": []
59
+      "topics": [
60
+
61
+      ]
46 62
     },
47 63
     {
48 64
       "slug": "raindrops",
49 65
       "difficulty": 3,
50
-      "topics": []
66
+      "topics": [
67
+
68
+      ]
51 69
     },
52 70
     {
53 71
       "slug": "difference-of-squares",
54 72
       "difficulty": 3,
55
-      "topics": []
73
+      "topics": [
74
+
75
+      ]
56 76
     },
57 77
     {
58 78
       "slug": "secret-handshake",
59 79
       "difficulty": 3,
60
-      "topics": []
80
+      "topics": [
81
+
82
+      ]
83
+    },
84
+    {
85
+      "slug": "perfect-numbers",
86
+      "difficulty": 3,
87
+      "topics": [
88
+
89
+      ]
61 90
     },
62 91
     {
63 92
       "slug": "sum-of-multiples",
64 93
       "difficulty": 4,
65
-      "topics": []
94
+      "topics": [
95
+
96
+      ]
66 97
     },
67 98
     {
68 99
       "slug": "luhn",
69 100
       "difficulty": 4,
70
-      "topics": []
101
+      "topics": [
102
+
103
+      ]
71 104
     },
72 105
     {
73 106
       "slug": "matrix",
74 107
       "difficulty": 4,
75
-      "topics": []
108
+      "topics": [
109
+
110
+      ]
76 111
     },
77 112
     {
78 113
       "slug": "triangle",
79 114
       "difficulty": 4,
80
-      "topics": []
115
+      "topics": [
116
+
117
+      ]
81 118
     },
82 119
     {
83 120
       "slug": "largest-series-product",
84 121
       "difficulty": 4,
85
-      "topics": []
122
+      "topics": [
123
+
124
+      ]
86 125
     },
87 126
     {
88 127
       "slug": "sieve",
89 128
       "difficulty": 4,
90
-      "topics": []
129
+      "topics": [
130
+
131
+      ]
91 132
     },
92 133
     {
93 134
       "slug": "twelve-days",
94 135
       "difficulty": 4,
95
-      "topics": []
136
+      "topics": [
137
+
138
+      ]
139
+    },
140
+    {
141
+      "slug": "kindergarten-garden",
142
+      "difficulty": 4,
143
+      "topics": [
144
+
145
+      ]
146
+    },
147
+    {
148
+      "slug": "collatz-conjecture",
149
+      "difficulty": 4,
150
+      "topics": [
151
+
152
+      ]
96 153
     },
97 154
     {
98 155
       "slug": "nth-prime",
99 156
       "difficulty": 4,
100
-      "topics": []
157
+      "topics": [
158
+
159
+      ]
160
+    },
161
+    {
162
+      "slug": "saddle-points",
163
+      "difficulty": 4,
164
+      "topics": [
165
+
166
+      ]
101 167
     },
102 168
     {
103 169
       "slug": "diamond",
104 170
       "difficulty": 4,
105
-      "topics": []
171
+      "topics": [
172
+
173
+      ]
174
+    },
175
+    {
176
+      "slug": "isogram",
177
+      "difficulty": 4,
178
+      "topics": [
179
+
180
+      ]
106 181
     },
107 182
     {
108 183
       "slug": "flatten-array",
109 184
       "difficulty": 5,
110
-      "topics": []
185
+      "topics": [
186
+
187
+      ]
111 188
     },
112 189
     {
113 190
       "slug": "pig-latin",
114 191
       "difficulty": 5,
115
-      "topics": []
192
+      "topics": [
193
+
194
+      ]
116 195
     },
117 196
     {
118 197
       "slug": "phone-number",
119 198
       "difficulty": 5,
120
-      "topics": []
199
+      "topics": [
200
+
201
+      ]
121 202
     },
122 203
     {
123
-      "slug": "accumulate",
204
+      "slug": "nucleotide-count",
124 205
       "difficulty": 5,
125
-      "topics": []
206
+      "topics": [
207
+
208
+      ]
126 209
     },
127 210
     {
128
-      "slug": "nucleotide-count",
211
+      "slug": "word-count",
129 212
       "difficulty": 5,
130
-      "topics": []
213
+      "topics": [
214
+
215
+      ]
131 216
     },
132 217
     {
133
-      "slug": "word-count",
218
+      "slug": "run-length-encoding",
134 219
       "difficulty": 5,
135
-      "topics": []
220
+      "topics": [
221
+
222
+      ]
136 223
     },
137 224
     {
138 225
       "slug": "robot-name",
139 226
       "difficulty": 5,
140
-      "topics": []
227
+      "topics": [
228
+
229
+      ]
141 230
     },
142 231
     {
143 232
       "slug": "prime-factors",
144 233
       "difficulty": 5,
145
-      "topics": []
234
+      "topics": [
235
+
236
+      ]
146 237
     },
147 238
     {
148 239
       "slug": "allergies",
149 240
       "difficulty": 5,
150
-      "topics": []
241
+      "topics": [
242
+
243
+      ]
151 244
     },
152 245
     {
153 246
       "slug": "bob",
154 247
       "difficulty": 5,
155
-      "topics": []
248
+      "topics": [
249
+
250
+      ]
156 251
     },
157 252
     {
158 253
       "slug": "pascals-triangle",
159 254
       "difficulty": 5,
160
-      "topics": []
255
+      "topics": [
256
+
257
+      ]
161 258
     },
162 259
     {
163 260
       "slug": "bracket-push",
164 261
       "difficulty": 5,
165
-      "topics": []
262
+      "topics": [
263
+
264
+      ]
166 265
     },
167 266
     {
168 267
       "slug": "series",
169 268
       "difficulty": 5,
170
-      "topics": []
269
+      "topics": [
270
+
271
+      ]
171 272
     },
172 273
     {
173 274
       "slug": "atbash-cipher",
174 275
       "difficulty": 5,
175
-      "topics": []
176
-    },
177
-    {
178
-      "slug": "strain",
179
-      "difficulty": 5,
180
-      "topics": []
276
+      "topics": [
277
+
278
+      ]
181 279
     },
182 280
     {
183 281
       "slug": "roman-numerals",
184 282
       "difficulty": 6,
185
-      "topics": []
283
+      "topics": [
284
+
285
+      ]
186 286
     },
187 287
     {
188 288
       "slug": "beer-song",
189 289
       "difficulty": 6,
190
-      "topics": []
290
+      "topics": [
291
+
292
+      ]
191 293
     },
192 294
     {
193 295
       "slug": "queen-attack",
194 296
       "difficulty": 6,
195
-      "topics": []
297
+      "topics": [
298
+
299
+      ]
196 300
     },
197 301
     {
198 302
       "slug": "etl",
199 303
       "difficulty": 6,
200
-      "topics": []
304
+      "topics": [
305
+
306
+      ]
201 307
     },
202 308
     {
203 309
       "slug": "linked-list",
204 310
       "difficulty": 6,
205
-      "topics": []
311
+      "topics": [
312
+
313
+      ]
206 314
     },
207 315
     {
208 316
       "slug": "grade-school",
209 317
       "difficulty": 6,
210
-      "topics": []
318
+      "topics": [
319
+
320
+      ]
211 321
     },
212 322
     {
213 323
       "slug": "robot-simulator",
214 324
       "difficulty": 6,
215
-      "topics": []
325
+      "topics": [
326
+
327
+      ]
216 328
     },
217 329
     {
218 330
       "slug": "binary-search",
219 331
       "difficulty": 6,
220
-      "topics": []
332
+      "topics": [
333
+
334
+      ]
221 335
     },
222 336
     {
223 337
       "slug": "minesweeper",
224 338
       "difficulty": 6,
225
-      "topics": []
339
+      "topics": [
340
+
341
+      ]
226 342
     },
227 343
     {
228 344
       "slug": "wordy",
229 345
       "difficulty": 6,
230
-      "topics": []
346
+      "topics": [
347
+
348
+      ]
231 349
     },
232 350
     {
233 351
       "slug": "all-your-base",
234 352
       "difficulty": 6,
235
-      "topics": []
353
+      "topics": [
354
+
355
+      ]
236 356
     },
237 357
     {
238 358
       "slug": "anagram",
239 359
       "difficulty": 7,
240
-      "topics": []
360
+      "topics": [
361
+
362
+      ]
241 363
     },
242 364
     {
243 365
       "slug": "sublist",
244 366
       "difficulty": 7,
245
-      "topics": []
367
+      "topics": [
368
+
369
+      ]
246 370
     },
247 371
     {
248
-      "slug": "simple-linked-list",
372
+      "slug": "word-search",
249 373
       "difficulty": 7,
250
-      "topics": []
374
+      "topics": [
375
+
376
+      ]
251 377
     },
252 378
     {
253
-      "slug": "binary-search-tree",
379
+      "slug": "simple-linked-list",
254 380
       "difficulty": 7,
255
-      "topics": []
381
+      "topics": [
382
+
383
+      ]
256 384
     },
257 385
     {
258
-      "slug": "rectangles",
386
+      "slug": "binary-search-tree",
259 387
       "difficulty": 7,
260
-      "topics": []
388
+      "topics": [
389
+
390
+      ]
261 391
     },
262 392
     {
263 393
       "slug": "meetup",
264 394
       "difficulty": 7,
265
-      "topics": []
395
+      "topics": [
396
+
397
+      ]
266 398
     },
267 399
     {
268 400
       "slug": "crypto-square",
269 401
       "difficulty": 7,
270
-      "topics": []
402
+      "topics": [
403
+
404
+      ]
271 405
     },
272 406
     {
273 407
       "slug": "poker",
@@ -279,65 +413,84 @@
279 413
       ]
280 414
     },
281 415
     {
282
-      "slug": "simple-cipher",
416
+      "slug": "clock",
417
+      "difficulty": 7,
418
+      "topics": [
419
+
420
+      ]
421
+    },
422
+    {
423
+      "slug": "ocr-numbers",
283 424
       "difficulty": 8,
284
-      "topics": []
425
+      "topics": [
426
+
427
+      ]
285 428
     },
286 429
     {
287
-      "slug": "palindrome-products",
430
+      "slug": "rectangles",
288 431
       "difficulty": 8,
289
-      "topics": []
432
+      "topics": [
433
+
434
+      ]
290 435
     },
291 436
     {
292
-      "slug": "pythagorean-triplet",
293
-      "difficulty": 9,
294
-      "topics": []
437
+      "slug": "book-store",
438
+      "difficulty": 8,
439
+      "topics": [
440
+
441
+      ]
295 442
     },
296 443
     {
297
-      "slug": "custom-set",
298
-      "difficulty": 10,
299
-      "topics": []
444
+      "slug": "simple-cipher",
445
+      "difficulty": 8,
446
+      "topics": [
447
+
448
+      ]
300 449
     },
301 450
     {
302
-      "slug": "clock",
303
-      "difficulty": 1,
304
-      "topics": []
451
+      "slug": "change",
452
+      "difficulty": 8,
453
+      "topics": [
454
+
455
+      ]
305 456
     },
306 457
     {
307
-      "slug": "perfect-numbers",
308
-      "difficulty": 1,
309
-      "topics": []
458
+      "slug": "palindrome-products",
459
+      "difficulty": 8,
460
+      "topics": [
461
+
462
+      ]
310 463
     },
311 464
     {
312
-      "slug": "change",
313
-      "difficulty": 1,
314
-      "topics": []
465
+      "slug": "pythagorean-triplet",
466
+      "difficulty": 9,
467
+      "topics": [
468
+
469
+      ]
315 470
     },
316 471
     {
317
-      "slug": "list-ops",
318
-      "difficulty": 1,
319
-      "topics": []
472
+      "slug": "custom-set",
473
+      "difficulty": 10,
474
+      "topics": [
475
+
476
+      ]
320 477
     },
321 478
     {
322
-      "slug": "ocr-numbers",
479
+      "slug": "list-ops",
323 480
       "difficulty": 1,
324
-      "topics": []
481
+      "topics": [
482
+
483
+      ]
325 484
     }
326 485
   ],
327 486
   "deprecated": [
487
+    "accumulate",
328 488
     "binary",
329 489
     "hexadecimal",
330 490
     "octal",
491
+    "strain",
331 492
     "trinary"
332 493
   ],
333
-  "ignored": [
334
-    "_template",
335
-    ".gradle",
336
-    "build",
337
-    "docs",
338
-    "gradle",
339
-    "scripts"
340
-  ],
341 494
   "foregone": [
342 495
     "leap",
343 496
     "grains",

SETUP.md → docs/EXERCISE_README_INSERT.md Dosyayı Görüntüle


+ 2
- 2
docs/INSTALLATION.md Dosyayı Görüntüle

@@ -12,7 +12,7 @@ Choose your operating system:
12 12
 * [Linux](#linux)
13 13
 
14 14
 ... or ...
15
-* if you prefer to not use a package maanger, you can [install manually](#install-manually).
15
+* if you prefer to not use a package manager, you can [install manually](#install-manually).
16 16
 
17 17
 Optionally, you can also use a [Java IDE](#java-ides).
18 18
 
@@ -42,7 +42,7 @@ Open an administrative command prompt.  (If you need assistance opening an admin
42 42
    ...
43 43
    ```
44 44
 
45
-We recommend closing the administrative command prompt and opening a new command prompt -- you do not require administrator priviledges to practice Exercism exercises.
45
+We recommend closing the administrative command prompt and opening a new command prompt -- you do not require administrator privileges to practice Exercism exercises.
46 46
 
47 47
 You now are ready to get started with the Java track of Exercism!
48 48
 

+ 4
- 21
docs/MAINTAINING.md Dosyayı Görüntüle

@@ -4,23 +4,22 @@ This is a guide/reference for maintainers of the Java track.
4 4
 
5 5
 - [Your Permissions](#your-permissions)
6 6
 - [Maintainer Guides](#maintainer-guides)
7
-- [The Project Board](#the-project-board)
8 7
 - [Miscellaneous](#miscellaneous)
9 8
 
10 9
 ## Your Permissions 
11 10
 
12
-As a maintainer, you have write access to four repositories.  "write access" means you can: review, reject, accept and merge PRs; and push changes to these repos.  Despite having permissions to push directly, we tend to seek review of even our own PRs.
11
+As a maintainer, you have write access to several repositories.  "write access" means you can: review, reject, accept and merge PRs; and push changes to these repos.  Despite having permissions to push directly, we tend to seek review of even our own PRs.
13 12
 
14 13
 ### Track-specific
15 14
 
16
-- [xjava](https://github.com/exercism/xjava) — yeah... you know what this one is. :)
15
+- [java](https://github.com/exercism/java) — yeah... you know what this one is. :)
17 16
 
18 17
 ### Exercism-wide
19 18
 
20
-- [x-common](https://github.com/exercism/x-common) — the library of canonical exercises.
19
+- [problem-specifications](https://github.com/exercism/problem-specifications) — the library of canonical exercises.
21 20
 - [discussions](https://github.com/exercism/discussions) — the place where project-wide conversations happen. 
22 21
   [issues sorted by most recently updated.](https://github.com/exercism/discussions/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)
23
-- [todo](https://github.com/exercism/todo) — not really used... might just go away completely in the future.
22
+- [docs](https://github.com/exercism/docs) - the place to find project-wide documentation.
24 23
 
25 24
 ## Maintainer Guides
26 25
 
@@ -28,22 +27,6 @@ As a maintainer, you have write access to four repositories.  "write access" mea
28 27
 - [exercism.io/docs/getting-involved-in-a-track.md](https://github.com/exercism/exercism.io/blob/master/docs/getting-involved-in-a-track.md)
29 28
 - [exercism.io/docs/reviewing-a-pull-request.md](https://github.com/exercism/exercism.io/blob/master/docs/reviewing-a-pull-request.md)
30 29
 
31
-## The Project Board
32
-
33
-GitHub issues are great, but there's no way to easily set priorities.
34
-To do this, we're using a GitHub Project: https://github.com/exercism/xjava/projects/2.
35
-
36
-- **Epics** — issues that really represent bigger ideas.  These inspire creating a set of smaller issues to be elaborated...
37
-- **Icebox** — issues that just needs a little more detail to be "ready to play"...
38
-- **Backlog** — issues ready to be worked.  When we start working on an issue, we move it to the next column...
39
-- **Current** — issues in progress.  When we've considered it done, we move the card to...
40
-- **Delivered** — completed issues that could use another pair of eyes.  When these are reviewed they get moved to...
41
-- **Done** — issues we've complete.  Every so often, we get together and it's nice to review what we've completed. 
42
-  Once reviewed, we remove them from this Project.
43
-
44
-The point of this board is to make clear our shared priorities.  It's a tool you can use.
45
-However, if you have an idea and want to implement it, you can just do it; it does not have to be added to this board.
46
-
47 30
 ## Miscellaneous
48 31
 
49 32
 - Issues marked with "policy" are current "team agreements": [exercism?label:policy](https://github.com/search?q=org%3Aexercism+label%3Apolicy).

+ 3
- 3
docs/TESTS.md Dosyayı Görüntüle

@@ -37,7 +37,7 @@ Choose your operating system:
37 37
    C:\Users\JohnDoe>gradle test
38 38
    ```
39 39
    *(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
40
-5. Solve the exercise.  Find and work through the `GETTING_STARTED.md` guide ([view on GitHub](https://github.com/exercism/xjava/blob/master/exercises/hello-world/GETTING_STARTED.md)).
40
+5. Solve the exercise.  Find and work through the `GETTING_STARTED.md` guide ([view on GitHub](https://github.com/exercism/java/blob/master/exercises/hello-world/GETTING_STARTED.md)).
41 41
 
42 42
 
43 43
 Good luck!  Have fun!
@@ -70,7 +70,7 @@ If you get stuck, at any point, don't forget to reach out for [help](http://exer
70 70
   $ gradle test
71 71
   ```
72 72
    *(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
73
-4. Solve the exercise.  Find and work through the `GETTING_STARTED.md` guide ([view on GitHub](https://github.com/exercism/xjava/blob/master/exercises/hello-world/GETTING_STARTED.md)).
73
+4. Solve the exercise.  Find and work through the `GETTING_STARTED.md` guide ([view on GitHub](https://github.com/exercism/java/blob/master/exercises/hello-world/GETTING_STARTED.md)).
74 74
 
75 75
 Good luck!  Have fun!
76 76
 
@@ -102,7 +102,7 @@ If you get stuck, at any point, don't forget to reach out for [help](http://exer
102 102
   $ gradle test
103 103
   ```
104 104
    *(Don't worry about the tests failing, at first, this is how you begin each exercise.)*
105
-4. Solve the exercise.  Find and work through the `GETTING_STARTED.md` guide ([view on GitHub](https://github.com/exercism/xjava/blob/master/exercises/hello-world/GETTING_STARTED.md)).
105
+4. Solve the exercise.  Find and work through the `GETTING_STARTED.md` guide ([view on GitHub](https://github.com/exercism/java/blob/master/exercises/hello-world/GETTING_STARTED.md)).
106 106
 
107 107
 Good luck!  Have fun!
108 108
 

+ 0
- 0
exercises/_template/src/example/java/.keep Dosyayı Görüntüle


+ 0
- 0
exercises/_template/src/main/java/.keep Dosyayı Görüntüle


+ 0
- 0
exercises/_template/src/test/java/.keep Dosyayı Görüntüle


+ 1
- 0
exercises/accumulate/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 4
- 4
exercises/accumulate/src/test/java/AccumulateTest.java Dosyayı Görüntüle

@@ -17,7 +17,7 @@ public class AccumulateTest {
17 17
         assertEquals(expectedOutput, Accumulate.accumulate(input, x -> x * x));
18 18
     }
19 19
 
20
-    @Ignore
20
+    @Ignore("Remove to run test")
21 21
     @Test
22 22
     public void accumulateSquares() {
23 23
         List<Integer> input = Arrays.asList(1, 2, 3);
@@ -25,7 +25,7 @@ public class AccumulateTest {
25 25
         assertEquals(expectedOutput, Accumulate.accumulate(input, x -> x * x));
26 26
     }
27 27
 
28
-    @Ignore
28
+    @Ignore("Remove to run test")
29 29
     @Test
30 30
     public void accumulateUpperCases() {
31 31
         List<String> input = Arrays.asList("hello", "world");
@@ -33,7 +33,7 @@ public class AccumulateTest {
33 33
         assertEquals(expectedOutput, Accumulate.accumulate(input, x -> x.toUpperCase()));
34 34
     }
35 35
 
36
-    @Ignore
36
+    @Ignore("Remove to run test")
37 37
     @Test
38 38
     public void accumulateReversedStrings() {
39 39
         List<String> input = Arrays.asList("the quick brown fox etc".split(" "));
@@ -45,7 +45,7 @@ public class AccumulateTest {
45 45
         return new StringBuilder(input).reverse().toString();
46 46
     }
47 47
 
48
-    @Ignore
48
+    @Ignore("Remove to run test")
49 49
     @Test
50 50
     public void accumulateWithinAccumulate() {
51 51
         List<String> input1 = Arrays.asList("a", "b", "c");

+ 1
- 0
exercises/acronym/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 15
- 3
exercises/acronym/src/example/java/Acronym.java Dosyayı Görüntüle

@@ -1,8 +1,19 @@
1 1
 import java.util.regex.Matcher;
2 2
 import java.util.regex.Pattern;
3 3
 
4
-public class Acronym {
5
-    public static String generate(String phrase){
4
+final class Acronym {
5
+
6
+    private final String acronym;
7
+
8
+    Acronym(String phrase) {
9
+        acronym = generateAcronym(phrase);
10
+    }
11
+
12
+    String get() {
13
+        return acronym;
14
+    }
15
+
16
+    private String generateAcronym(String phrase){
6 17
         final Pattern BREAK_WORDS = Pattern.compile("[A-Z]+[a-z]*|[a-z]+");
7 18
         final Matcher matcher = BREAK_WORDS.matcher(phrase);
8 19
         final StringBuilder b = new StringBuilder();
@@ -11,4 +22,5 @@ public class Acronym {
11 22
         }
12 23
         return b.toString().toUpperCase();
13 24
     }
14
-}
25
+
26
+}

+ 11
- 0
exercises/acronym/src/main/java/Acronym.java Dosyayı Görüntüle

@@ -0,0 +1,11 @@
1
+class Acronym {
2
+
3
+    Acronym(String phrase) {
4
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
5
+    }
6
+
7
+    String get() {
8
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
9
+    }
10
+
11
+}

+ 14
- 28
exercises/acronym/src/test/java/AcronymTest.java Dosyayı Görüntüle

@@ -3,70 +3,56 @@ import org.junit.Ignore;
3 3
 
4 4
 import static org.junit.Assert.assertEquals;
5 5
 
6
+/*
7
+ * version: 1.1.0
8
+ */
6 9
 public class AcronymTest {
7 10
 
8
-
9 11
     @Test
10 12
     public void fromTitleCasedPhrases() {
11 13
         final String phrase = "Portable Network Graphics";
12 14
         final String expected = "PNG";
13
-        assertEquals(expected, Acronym.generate(phrase));
15
+        assertEquals(expected, new Acronym(phrase).get());
14 16
     }
15 17
 
16
-    @Ignore
18
+    @Ignore("Remove to run test")
17 19
     @Test
18 20
     public void fromOtherTitleCasedPhrases() {
19 21
         final String phrase = "Ruby on Rails";
20 22
         final String expected = "ROR";
21
-        assertEquals(expected, Acronym.generate(phrase));
22
-    }
23
-
24
-    @Ignore
25
-    @Test
26
-    public void fromInconsistentlyCasedPhrases() {
27
-        final String phrase = "HyperText Markup Language";
28
-        final String expected = "HTML";
29
-        assertEquals(expected, Acronym.generate(phrase));
23
+        assertEquals(expected, new Acronym(phrase).get());
30 24
     }
31 25
 
32
-    @Ignore
26
+    @Ignore("Remove to run test")
33 27
     @Test
34 28
     public void fromPhrasesWithPunctuation() {
35 29
         final String phrase = "First In, First Out";
36 30
         final String expected = "FIFO";
37
-        assertEquals(expected, Acronym.generate(phrase));
31
+        assertEquals(expected, new Acronym(phrase).get());
38 32
     }
39 33
 
40
-    @Ignore
34
+    @Ignore("Remove to run test")
41 35
     @Test
42 36
     public void fromOtherPhrasesWithPunctuation() {
43 37
         final String phrase = "PHP: Hypertext Preprocessor";
44 38
         final String expected = "PHP";
45
-        assertEquals(expected, Acronym.generate(phrase));
39
+        assertEquals(expected, new Acronym(phrase).get());
46 40
     }
47 41
 
48
-    @Ignore
42
+    @Ignore("Remove to run test")
49 43
     @Test
50 44
     public void fromPhrasesWithNonAcronymAllCapsWord() {
51 45
         final String phrase = "GNU Image Manipulation Program";
52 46
         final String expected = "GIMP";
53
-        assertEquals(expected, Acronym.generate(phrase));
47
+        assertEquals(expected, new Acronym(phrase).get());
54 48
     }
55 49
 
56
-    @Ignore
50
+    @Ignore("Remove to run test")
57 51
     @Test
58 52
     public void fromPhrasesWithPunctuationAndSentenceCasing() {
59 53
         final String phrase = "Complementary metal-oxide semiconductor";
60 54
         final String expected = "CMOS";
61
-        assertEquals(expected, Acronym.generate(phrase));
62
-    }
63
-
64
-    @Ignore
65
-    @Test
66
-    public void fromPhraseWithSingleLetterWord() {
67
-        final String phrase = "Cat in a Hat";
68
-        final String expected = "CIAH";
69
-        assertEquals(expected, Acronym.generate(phrase));
55
+        assertEquals(expected, new Acronym(phrase).get());
70 56
     }
71 57
 
72 58
 }

+ 1
- 0
exercises/all-your-base/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 1
- 1
exercises/all-your-base/src/main/java/BaseConverter.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-final class BaseConverter {
1
+class BaseConverter {
2 2
 
3 3
 
4 4
 

+ 43
- 40
exercises/all-your-base/src/test/java/BaseConverterTest.java Dosyayı Görüntüle

@@ -7,7 +7,10 @@ import java.util.Arrays;
7 7
 
8 8
 import static org.junit.Assert.assertArrayEquals;
9 9
 
10
-public final class BaseConverterTest {
10
+/*
11
+ * version: 1.1.0
12
+ */
13
+public class BaseConverterTest {
11 14
 
12 15
     /*
13 16
      * See https://github.com/junit-team/junit4/wiki/Rules for information on JUnit Rules in general and
@@ -32,7 +35,7 @@ public final class BaseConverterTest {
32 35
                 actualDigits);
33 36
     }
34 37
 
35
-    @Ignore
38
+    @Ignore("Remove to run test")
36 39
     @Test
37 40
     public void testBinaryToSingleDecimal() {
38 41
         final BaseConverter baseConverter = new BaseConverter(2, new int[]{1, 0, 1});
@@ -49,7 +52,7 @@ public final class BaseConverterTest {
49 52
                 actualDigits);
50 53
     }
51 54
 
52
-    @Ignore
55
+    @Ignore("Remove to run test")
53 56
     @Test
54 57
     public void testSingleDecimalToBinary() {
55 58
         final BaseConverter baseConverter = new BaseConverter(10, new int[]{5});
@@ -66,7 +69,7 @@ public final class BaseConverterTest {
66 69
                 actualDigits);
67 70
     }
68 71
 
69
-    @Ignore
72
+    @Ignore("Remove to run test")
70 73
     @Test
71 74
     public void testBinaryToMultipleDecimal() {
72 75
         final BaseConverter baseConverter = new BaseConverter(2, new int[]{1, 0, 1, 0, 1, 0});
@@ -83,7 +86,7 @@ public final class BaseConverterTest {
83 86
                 actualDigits);
84 87
     }
85 88
 
86
-    @Ignore
89
+    @Ignore("Remove to run test")
87 90
     @Test
88 91
     public void testDecimalToBinary() {
89 92
         final BaseConverter baseConverter = new BaseConverter(10, new int[]{4, 2});
@@ -100,7 +103,7 @@ public final class BaseConverterTest {
100 103
                 actualDigits);
101 104
     }
102 105
 
103
-    @Ignore
106
+    @Ignore("Remove to run test")
104 107
     @Test
105 108
     public void testTrinaryToHexadecimal() {
106 109
         final BaseConverter baseConverter = new BaseConverter(3, new int[]{1, 1, 2, 0});
@@ -117,7 +120,7 @@ public final class BaseConverterTest {
117 120
                 actualDigits);
118 121
     }
119 122
 
120
-    @Ignore
123
+    @Ignore("Remove to run test")
121 124
     @Test
122 125
     public void testHexadecimalToTrinary() {
123 126
         final BaseConverter baseConverter = new BaseConverter(16, new int[]{2, 10});
@@ -134,7 +137,7 @@ public final class BaseConverterTest {
134 137
                 actualDigits);
135 138
     }
136 139
 
137
-    @Ignore
140
+    @Ignore("Remove to run test")
138 141
     @Test
139 142
     public void test15BitInteger() {
140 143
         final BaseConverter baseConverter = new BaseConverter(97, new int[]{3, 46, 60});
@@ -151,7 +154,7 @@ public final class BaseConverterTest {
151 154
                 actualDigits);
152 155
     }
153 156
 
154
-    @Ignore
157
+    @Ignore("Remove to run test")
155 158
     @Test
156 159
     public void testEmptyDigits() {
157 160
         expectedException.expect(IllegalArgumentException.class);
@@ -160,7 +163,7 @@ public final class BaseConverterTest {
160 163
         new BaseConverter(2, new int[]{});
161 164
     }
162 165
 
163
-    @Ignore
166
+    @Ignore("Remove to run test")
164 167
     @Test
165 168
     public void testSingleZero() {
166 169
         final BaseConverter baseConverter = new BaseConverter(10, new int[]{0});
@@ -177,7 +180,7 @@ public final class BaseConverterTest {
177 180
                 actualDigits);
178 181
     }
179 182
 
180
-    @Ignore
183
+    @Ignore("Remove to run test")
181 184
     @Test
182 185
     public void testMultipleZeros() {
183 186
         expectedException.expect(IllegalArgumentException.class);
@@ -186,7 +189,7 @@ public final class BaseConverterTest {
186 189
         new BaseConverter(10, new int[]{0, 0, 0});
187 190
     }
188 191
 
189
-    @Ignore
192
+    @Ignore("Remove to run test")
190 193
     @Test
191 194
     public void testLeadingZeros() {
192 195
         expectedException.expect(IllegalArgumentException.class);
@@ -195,74 +198,74 @@ public final class BaseConverterTest {
195 198
         new BaseConverter(7, new int[]{0, 6, 0});
196 199
     }
197 200
 
198
-    @Ignore
201
+    @Ignore("Remove to run test")
199 202
     @Test
200
-    public void testNegativeDigit() {
203
+    public void testFirstBaseIsOne() {
201 204
         expectedException.expect(IllegalArgumentException.class);
202
-        expectedException.expectMessage("Digits may not be negative.");
205
+        expectedException.expectMessage("Bases must be at least 2.");
203 206
 
204
-        new BaseConverter(2, new int[]{1, -1, 1, 0, 1, 0});
207
+        new BaseConverter(1, new int[]{});
205 208
     }
206 209
 
207
-    @Ignore
210
+    @Ignore("Remove to run test")
208 211
     @Test
209
-    public void testInvalidPositiveDigit() {
212
+    public void testFirstBaseIsZero() {
210 213
         expectedException.expect(IllegalArgumentException.class);
211
-        expectedException.expectMessage("All digits must be strictly less than the base.");
214
+        expectedException.expectMessage("Bases must be at least 2.");
212 215
 
213
-        new BaseConverter(2, new int[]{1, 2, 1, 0, 1, 0});
216
+        new BaseConverter(0, new int[]{});
214 217
     }
215 218
 
216
-    @Ignore
219
+    @Ignore("Remove to run test")
217 220
     @Test
218
-    public void testFirstBaseIsOne() {
221
+    public void testFirstBaseIsNegative() {
219 222
         expectedException.expect(IllegalArgumentException.class);
220 223
         expectedException.expectMessage("Bases must be at least 2.");
221 224
 
222
-        new BaseConverter(1, new int[]{});
225
+        new BaseConverter(-2, new int[]{});
223 226
     }
224 227
 
225
-    @Ignore
228
+    @Ignore("Remove to run test")
226 229
     @Test
227
-    public void testSecondBaseIsOne() {
228
-        final BaseConverter baseConverter = new BaseConverter(2, new int[]{1, 0, 1, 0, 1, 0});
229
-
230
+    public void testNegativeDigit() {
230 231
         expectedException.expect(IllegalArgumentException.class);
231
-        expectedException.expectMessage("Bases must be at least 2.");
232
+        expectedException.expectMessage("Digits may not be negative.");
232 233
 
233
-        baseConverter.convertToBase(1);
234
+        new BaseConverter(2, new int[]{1, -1, 1, 0, 1, 0});
234 235
     }
235 236
 
236
-    @Ignore
237
+    @Ignore("Remove to run test")
237 238
     @Test
238
-    public void testFirstBaseIsZero() {
239
+    public void testInvalidPositiveDigit() {
239 240
         expectedException.expect(IllegalArgumentException.class);
240
-        expectedException.expectMessage("Bases must be at least 2.");
241
+        expectedException.expectMessage("All digits must be strictly less than the base.");
241 242
 
242
-        new BaseConverter(0, new int[]{});
243
+        new BaseConverter(2, new int[]{1, 2, 1, 0, 1, 0});
243 244
     }
244 245
 
245
-    @Ignore
246
+    @Ignore("Remove to run test")
246 247
     @Test
247
-    public void testSecondBaseIsZero() {
248
+    public void testSecondBaseIsOne() {
248 249
         final BaseConverter baseConverter = new BaseConverter(2, new int[]{1, 0, 1, 0, 1, 0});
249 250
 
250 251
         expectedException.expect(IllegalArgumentException.class);
251 252
         expectedException.expectMessage("Bases must be at least 2.");
252 253
 
253
-        baseConverter.convertToBase(0);
254
+        baseConverter.convertToBase(1);
254 255
     }
255 256
 
256
-    @Ignore
257
+    @Ignore("Remove to run test")
257 258
     @Test
258
-    public void testFirstBaseIsNegative() {
259
+    public void testSecondBaseIsZero() {
260
+        final BaseConverter baseConverter = new BaseConverter(2, new int[]{1, 0, 1, 0, 1, 0});
261
+
259 262
         expectedException.expect(IllegalArgumentException.class);
260 263
         expectedException.expectMessage("Bases must be at least 2.");
261 264
 
262
-        new BaseConverter(-2, new int[]{});
265
+        baseConverter.convertToBase(0);
263 266
     }
264 267
 
265
-    @Ignore
268
+    @Ignore("Remove to run test")
266 269
     @Test
267 270
     public void testSecondBaseIsNegative() {
268 271
         final BaseConverter baseConverter = new BaseConverter(2, new int[]{1});

+ 1
- 0
exercises/allergies/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 18
- 18
exercises/allergies/src/test/java/AllergiesTest.java Dosyayı Görüntüle

@@ -20,7 +20,7 @@ public class AllergiesTest {
20 20
         assertEquals(false, allergies.isAllergicTo(Allergen.CATS));
21 21
     }
22 22
 
23
-    @Ignore
23
+    @Ignore("Remove to run test")
24 24
     @Test
25 25
     public void allergicToEggs() {
26 26
         Allergies allergies = new Allergies(1);
@@ -28,7 +28,7 @@ public class AllergiesTest {
28 28
         assertEquals(true, allergies.isAllergicTo(Allergen.EGGS));
29 29
     }
30 30
 
31
-    @Ignore
31
+    @Ignore("Remove to run test")
32 32
     @Test
33 33
     public void allergicToPeanuts() {
34 34
         Allergies allergies = new Allergies(2);
@@ -36,7 +36,7 @@ public class AllergiesTest {
36 36
         assertEquals(true, allergies.isAllergicTo(Allergen.PEANUTS));
37 37
     }
38 38
 
39
-    @Ignore
39
+    @Ignore("Remove to run test")
40 40
     @Test
41 41
     public void allergicToShellfish() {
42 42
         Allergies allergies = new Allergies(4);
@@ -44,7 +44,7 @@ public class AllergiesTest {
44 44
         assertEquals(true, allergies.isAllergicTo(Allergen.SHELLFISH));
45 45
     }
46 46
 
47
-    @Ignore
47
+    @Ignore("Remove to run test")
48 48
     @Test
49 49
     public void allergicToStrawberries() {
50 50
         Allergies allergies = new Allergies(8);
@@ -52,7 +52,7 @@ public class AllergiesTest {
52 52
         assertEquals(true, allergies.isAllergicTo(Allergen.STRAWBERRIES));
53 53
     }
54 54
 
55
-    @Ignore
55
+    @Ignore("Remove to run test")
56 56
     @Test
57 57
     public void allergicToTomatoes() {
58 58
         Allergies allergies = new Allergies(16);
@@ -60,7 +60,7 @@ public class AllergiesTest {
60 60
         assertEquals(true, allergies.isAllergicTo(Allergen.TOMATOES));
61 61
     }
62 62
 
63
-    @Ignore
63
+    @Ignore("Remove to run test")
64 64
     @Test
65 65
     public void allergicToChocolate() {
66 66
         Allergies allergies = new Allergies(32);
@@ -68,7 +68,7 @@ public class AllergiesTest {
68 68
         assertEquals(true, allergies.isAllergicTo(Allergen.CHOCOLATE));
69 69
     }
70 70
 
71
-    @Ignore
71
+    @Ignore("Remove to run test")
72 72
     @Test
73 73
     public void allergicToPollen() {
74 74
         Allergies allergies = new Allergies(64);
@@ -76,7 +76,7 @@ public class AllergiesTest {
76 76
         assertEquals(true, allergies.isAllergicTo(Allergen.POLLEN));
77 77
     }
78 78
 
79
-    @Ignore
79
+    @Ignore("Remove to run test")
80 80
     @Test
81 81
     public void allergicToCats() {
82 82
         Allergies allergies = new Allergies(128);
@@ -84,7 +84,7 @@ public class AllergiesTest {
84 84
         assertEquals(true, allergies.isAllergicTo(Allergen.CATS));
85 85
     }
86 86
 
87
-    @Ignore
87
+    @Ignore("Remove to run test")
88 88
     @Test
89 89
     public void isAllergicToEggsInAdditionToOtherStuff() {
90 90
         Allergies allergies = new Allergies(5);
@@ -94,7 +94,7 @@ public class AllergiesTest {
94 94
         assertEquals(false, allergies.isAllergicTo(Allergen.STRAWBERRIES));
95 95
     }
96 96
 
97
-    @Ignore
97
+    @Ignore("Remove to run test")
98 98
     @Test
99 99
     public void noAllergies() {
100 100
         Allergies allergies = new Allergies(0);
@@ -102,7 +102,7 @@ public class AllergiesTest {
102 102
         assertEquals(0, allergies.getList().size());
103 103
     }
104 104
 
105
-    @Ignore
105
+    @Ignore("Remove to run test")
106 106
     @Test
107 107
     public void isAllergicToJustEggs() {
108 108
         Allergies allergies = new Allergies(1);
@@ -111,7 +111,7 @@ public class AllergiesTest {
111 111
         assertEquals(expectedAllergens, allergies.getList());
112 112
     }
113 113
 
114
-    @Ignore
114
+    @Ignore("Remove to run test")
115 115
     @Test
116 116
     public void isAllergicToJustPeanuts() {
117 117
         Allergies allergies = new Allergies(2);
@@ -120,7 +120,7 @@ public class AllergiesTest {
120 120
         assertEquals(expectedAllergens, allergies.getList());
121 121
     }
122 122
 
123
-    @Ignore
123
+    @Ignore("Remove to run test")
124 124
     @Test
125 125
     public void isAllergicToJustStrawberries() {
126 126
         Allergies allergies = new Allergies(8);
@@ -129,7 +129,7 @@ public class AllergiesTest {
129 129
         assertEquals(expectedAllergens, allergies.getList());
130 130
     }
131 131
 
132
-    @Ignore
132
+    @Ignore("Remove to run test")
133 133
     @Test
134 134
     public void isAllergicToEggsAndPeanuts() {
135 135
         Allergies allergies = new Allergies(3);
@@ -141,7 +141,7 @@ public class AllergiesTest {
141 141
         assertEquals(expectedAllergens, allergies.getList());
142 142
     }
143 143
 
144
-    @Ignore
144
+    @Ignore("Remove to run test")
145 145
     @Test
146 146
     public void isAllergicToEggsAndShellfish() {
147 147
         Allergies allergies = new Allergies(5);
@@ -153,7 +153,7 @@ public class AllergiesTest {
153 153
         assertEquals(expectedAllergens, allergies.getList());
154 154
     }
155 155
 
156
-    @Ignore
156
+    @Ignore("Remove to run test")
157 157
     @Test
158 158
     public void isAllergicToLotsOfStuff() {
159 159
         Allergies allergies = new Allergies(248);
@@ -168,7 +168,7 @@ public class AllergiesTest {
168 168
         assertEquals(expectedAllergens, allergies.getList());
169 169
     }
170 170
 
171
-    @Ignore
171
+    @Ignore("Remove to run test")
172 172
     @Test
173 173
     public void isAllergicToEverything() {
174 174
         Allergies allergies = new Allergies(255);
@@ -186,7 +186,7 @@ public class AllergiesTest {
186 186
         assertEquals(expectedAllergens, allergies.getList());
187 187
     }
188 188
 
189
-    @Ignore
189
+    @Ignore("Remove to run test")
190 190
     @Test
191 191
     public void ignoreNonAllergenScoreParts() {
192 192
         Allergies allergies = new Allergies(509);

+ 1
- 0
exercises/anagram/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 15
- 15
exercises/anagram/src/test/java/AnagramTest.java Dosyayı Görüntüle

@@ -16,7 +16,7 @@ public class AnagramTest {
16 16
         assertTrue(detector.match(Arrays.asList("hello", "world", "zombies", "pants")).isEmpty());
17 17
     }
18 18
 
19
-    @Ignore
19
+    @Ignore("Remove to run test")
20 20
     @Test
21 21
     public void testDetectSimpleAnagram() {
22 22
         Anagram detector = new Anagram("ant");
@@ -25,7 +25,7 @@ public class AnagramTest {
25 25
         assertThat(anagram.size(), is(1));
26 26
     }
27 27
 
28
-    @Ignore
28
+    @Ignore("Remove to run test")
29 29
     @Test
30 30
     public void testDetectLongerAnagram() {
31 31
         Anagram detector = new Anagram("listen");
@@ -33,7 +33,7 @@ public class AnagramTest {
33 33
         assertThat(anagrams, hasItem("inlets"));
34 34
     }
35 35
 
36
-    @Ignore
36
+    @Ignore("Remove to run test")
37 37
     @Test
38 38
     public void testDetectMultipleAnagrams() {
39 39
         Anagram detector = new Anagram("master");
@@ -41,7 +41,7 @@ public class AnagramTest {
41 41
         assertThat(anagrams, allOf(hasItem("maters"), hasItem("stream")));
42 42
     }
43 43
 
44
-    @Ignore
44
+    @Ignore("Remove to run test")
45 45
     @Test
46 46
     public void testDetectMultipleAnagramsForLongerWord() {
47 47
         Anagram detector = new Anagram("allergy");
@@ -49,14 +49,14 @@ public class AnagramTest {
49 49
         assertThat(anagrams, allOf(hasItem("gallery"), hasItem("largely"), hasItem("regally")));
50 50
     }
51 51
 
52
-    @Ignore
52
+    @Ignore("Remove to run test")
53 53
     @Test
54 54
     public void testDoesNotConfuseDifferentDuplicates() {
55 55
         Anagram detector = new Anagram("galea");
56 56
         assertTrue(detector.match(Arrays.asList("eagle")).isEmpty());
57 57
     }
58 58
 
59
-    @Ignore
59
+    @Ignore("Remove to run test")
60 60
     @Test
61 61
     public void testIdenticalWordIsNotAnagram() {
62 62
         Anagram detector = new Anagram("corn");
@@ -65,35 +65,35 @@ public class AnagramTest {
65 65
         assertThat(anagrams.size(), is(1));
66 66
     }
67 67
 
68
-    @Ignore
68
+    @Ignore("Remove to run test")
69 69
     @Test
70 70
     public void testIdenticalWordRepeatedIsNotAnagram() {
71 71
         Anagram detector = new Anagram("go");
72 72
         assertTrue(detector.match(Arrays.asList("go Go GO")).isEmpty());
73 73
     }
74 74
 
75
-    @Ignore
75
+    @Ignore("Remove to run test")
76 76
     @Test
77 77
     public void testCapitalWordIsNotOwnAnagram() {
78 78
         Anagram detector = new Anagram("BANANA");
79 79
         assertTrue(detector.match(Arrays.asList("Banana")).isEmpty());
80 80
     }
81 81
 
82
-    @Ignore
82
+    @Ignore("Remove to run test")
83 83
     @Test
84 84
     public void testEliminateAnagramsWithSameChecksum() {
85 85
         Anagram detector = new Anagram("mass");
86 86
         assertTrue(detector.match(Arrays.asList("last")).isEmpty());
87 87
     }
88 88
 
89
-    @Ignore
89
+    @Ignore("Remove to run test")
90 90
     @Test
91 91
     public void testEliminateAnagramSubsets() {
92 92
         Anagram detector = new Anagram("good");
93 93
         assertTrue(detector.match(Arrays.asList("dog", "goody")).isEmpty());
94 94
     }
95 95
 
96
-    @Ignore
96
+    @Ignore("Remove to run test")
97 97
     @Test
98 98
     public void testCaseInsensitiveWhenSubjectStartsWithUpperCaseLetter() {
99 99
         Anagram detector = new Anagram("Orchestra");
@@ -101,7 +101,7 @@ public class AnagramTest {
101 101
         assertThat(anagrams, hasItem("carthorse"));
102 102
     }
103 103
 
104
-    @Ignore
104
+    @Ignore("Remove to run test")
105 105
     @Test
106 106
     public void testCaseInsensitiveWhenAnagramStartsWithUpperCaseLetter() {
107 107
         Anagram detector = new Anagram("orchestra");
@@ -109,7 +109,7 @@ public class AnagramTest {
109 109
         assertThat(anagrams, hasItem("Carthorse"));
110 110
     }
111 111
 
112
-    @Ignore
112
+    @Ignore("Remove to run test")
113 113
     @Test
114 114
     public void testCaseInsensitiveWhenBothAnagramAndSubjectStartWithUpperCaseLetter() {
115 115
         Anagram detector = new Anagram("Orchestra");
@@ -117,14 +117,14 @@ public class AnagramTest {
117 117
         assertThat(anagrams, hasItem("Carthorse"));
118 118
     }
119 119
 
120
-    @Ignore
120
+    @Ignore("Remove to run test")
121 121
     @Test
122 122
     public void testWordIsNotItsOwnAnagram() {
123 123
         Anagram detector = new Anagram("banana");
124 124
         assertTrue(detector.match(Arrays.asList("Banana")).isEmpty());
125 125
     }
126 126
 
127
-    @Ignore
127
+    @Ignore("Remove to run test")
128 128
     @Test
129 129
     public void testAnagramMustUseAllLettersExactlyOnce() {
130 130
         Anagram detector = new Anagram("tapper");

+ 1
- 0
exercises/atbash-cipher/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 5
- 5
exercises/atbash-cipher/src/example/java/Atbash.java Dosyayı Görüntüle

@@ -7,7 +7,7 @@ public class Atbash {
7 7
     private static final String PLAIN = "abcdefghijklmnopqrstuvwxyz";
8 8
     private static final String CIPHER = "zyxwvutsrqponmlkjihgfedcba";
9 9
 
10
-    public static String encode(String input) {
10
+    public String encode(String input) {
11 11
         String encoded = stripInvalidCharacters(input).toLowerCase();
12 12
         String cyphered = "";
13 13
 
@@ -18,7 +18,7 @@ public class Atbash {
18 18
         return splitIntoFiveLetterWords(cyphered);
19 19
     }
20 20
 
21
-    public static String decode(String input) {
21
+    public String decode(String input) {
22 22
         String encoded = stripInvalidCharacters(input).toLowerCase();
23 23
         String deciphered = "";
24 24
 
@@ -29,7 +29,7 @@ public class Atbash {
29 29
         return deciphered;
30 30
     }
31 31
 
32
-    private static String stripInvalidCharacters(String input) {
32
+    private String stripInvalidCharacters(String input) {
33 33
         String filteredValue = "";
34 34
 
35 35
         for (char c : input.toCharArray()) {
@@ -41,13 +41,13 @@ public class Atbash {
41 41
         return filteredValue;
42 42
     }
43 43
 
44
-    private static char applyCipher(char input) {
44
+    private char applyCipher(char input) {
45 45
         int idx = PLAIN.indexOf(input);
46 46
 
47 47
         return idx >= 0 ? CIPHER.toCharArray()[idx] : input;
48 48
     }
49 49
 
50
-    private static String splitIntoFiveLetterWords(String value) {
50
+    private String splitIntoFiveLetterWords(String value) {
51 51
         List<String> words = new ArrayList<>();
52 52
 
53 53
         for (int i = 0; i < value.length(); i += GROUP_SIZE) {

+ 19
- 19
exercises/atbash-cipher/src/test/java/AtbashTest.java Dosyayı Görüntüle

@@ -1,5 +1,5 @@
1
-import org.junit.Test;
2 1
 import org.junit.Ignore;
2
+import org.junit.Test;
3 3
 import org.junit.experimental.runners.Enclosed;
4 4
 import org.junit.runner.RunWith;
5 5
 import org.junit.runners.Parameterized;
@@ -20,14 +20,14 @@ public class AtbashTest {
20 20
 
21 21
         @Parameters(name = "{index}: expected plaintext \"{0}\" to encode to ciphertext \"{1}\".")
22 22
         public static Collection<Object[]> data() {
23
-            return Arrays.asList(new Object[][] {
24
-                    { "no", "ml" },
25
-                    { "yes", "bvh" },
26
-                    { "OMG", "lnt" },
27
-                    { "mindblowingly", "nrmwy oldrm tob" },
28
-                    { "Testing, 1 2 3, testing.", "gvhgr mt123 gvhgr mt" },
29
-                    { "Truth is fiction.", "gifgs rhurx grlm" },
30
-                    { "The quick brown fox jumps over the lazy dog.", "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt" }
23
+            return Arrays.asList(new Object[][]{
24
+                    {"no", "ml"},
25
+                    {"yes", "bvh"},
26
+                    {"OMG", "lnt"},
27
+                    {"mindblowingly", "nrmwy oldrm tob"},
28
+                    {"Testing, 1 2 3, testing.", "gvhgr mt123 gvhgr mt"},
29
+                    {"Truth is fiction.", "gifgs rhurx grlm"},
30
+                    {"The quick brown fox jumps over the lazy dog.", "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt"}
31 31
             });
32 32
         }
33 33
 
@@ -37,9 +37,9 @@ public class AtbashTest {
37 37
         }
38 38
 
39 39
 
40
-    @Test
40
+        @Test
41 41
         public void test() {
42
-            assertEquals(ciphertext, Atbash.encode(plaintext));
42
+            assertEquals(ciphertext, new Atbash().encode(plaintext));
43 43
         }
44 44
     }
45 45
 
@@ -50,11 +50,11 @@ public class AtbashTest {
50 50
 
51 51
         @Parameters(name = "{index}: expected ciphertext \"{0}\" to decode to plaintext \"{1}\".")
52 52
         public static Collection<Object[]> data() {
53
-            return Arrays.asList(new Object[][] {
54
-                    { "vcvix rhn", "exercism" },
55
-                    { "zmlyh gzxov rhlug vmzhg vkkrm thglm v", "anobstacleisoftenasteppingstone" },
56
-                    { "gvhgr mt123 gvhgr mt", "testing123testing" },
57
-                    { "gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt", "thequickbrownfoxjumpsoverthelazydog" }
53
+            return Arrays.asList(new Object[][]{
54
+                    {"vcvix rhn", "exercism"},
55
+                    {"zmlyh gzxov rhlug vmzhg vkkrm thglm v", "anobstacleisoftenasteppingstone"},
56
+                    {"gvhgr mt123 gvhgr mt", "testing123testing"},
57
+                    {"gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt", "thequickbrownfoxjumpsoverthelazydog"}
58 58
             });
59 59
         }
60 60
 
@@ -63,10 +63,10 @@ public class AtbashTest {
63 63
             this.plaintext = plaintext;
64 64
         }
65 65
 
66
-        @Ignore
67
-    @Test
66
+        @Ignore("Remove to run tests")
67
+        @Test
68 68
         public void test() {
69
-            assertEquals(plaintext, Atbash.decode(ciphertext));
69
+            assertEquals(plaintext, new Atbash().decode(ciphertext));
70 70
         }
71 71
     }
72 72
 }

+ 1
- 0
exercises/beer-song/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 4
- 7
exercises/beer-song/src/example/java/BeerSong.java Dosyayı Görüntüle

@@ -1,8 +1,6 @@
1 1
 public class BeerSong {
2
-    public static String verse(int number)
3
-    {
4
-        switch (number)
5
-        {
2
+    public String verse(int number) {
3
+        switch (number) {
6 4
             case 0:
7 5
                 return "No 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";
8 6
             case 1:
@@ -14,8 +12,7 @@ public class BeerSong {
14 12
         }
15 13
     }
16 14
 
17
-    public static String sing(int start, int stop)
18
-    {
15
+    public String sing(int start, int stop) {
19 16
         StringBuilder songOutput = new StringBuilder();
20 17
 
21 18
         for (int i=start; i>=stop; i--) {
@@ -25,7 +22,7 @@ public class BeerSong {
25 22
         return songOutput.toString();
26 23
     }
27 24
 
28
-    public static String singSong() {
25
+    public String singSong() {
29 26
         return sing(99,0);
30 27
     }
31 28
 }

+ 21
- 13
exercises/beer-song/src/test/java/BeerSongTest.java Dosyayı Görüntüle

@@ -1,50 +1,58 @@
1 1
 import org.junit.Test;
2 2
 import org.junit.Ignore;
3
+import org.junit.Before;
3 4
 
4 5
 import static org.junit.Assert.assertEquals;
5 6
 
6 7
 public class BeerSongTest {
7 8
 
9
+    private BeerSong beerSong;
10
+
11
+    @Before
12
+    public void setup(){
13
+        beerSong = new BeerSong();
14
+    }
15
+
8 16
     @Test
9 17
     public void singFirstVerse() {
10 18
         assertEquals("99 bottles of beer on the wall, 99 bottles of beer.\n" +
11 19
                         "Take one down and pass it around, 98 bottles of beer on the wall.\n\n",
12
-                BeerSong.verse(99));
20
+                beerSong.verse(99));
13 21
     }
14 22
 
15
-    @Ignore
23
+    @Ignore("Remove to run test")
16 24
     @Test
17 25
     public void singMiddleVerse() {
18 26
         assertEquals("44 bottles of beer on the wall, 44 bottles of beer.\n" +
19 27
                         "Take one down and pass it around, 43 bottles of beer on the wall.\n\n",
20
-                BeerSong.verse(44));
28
+                beerSong.verse(44));
21 29
     }
22 30
 
23
-    @Ignore
31
+    @Ignore("Remove to run test")
24 32
     @Test
25 33
     public void singThirdToLastVerse() {
26 34
         assertEquals("2 bottles of beer on the wall, 2 bottles of beer.\n" +
27 35
                         "Take one down and pass it around, 1 bottle of beer on the wall.\n\n",
28
-                BeerSong.verse(2));
36
+                beerSong.verse(2));
29 37
     }
30 38
 
31
-    @Ignore
39
+    @Ignore("Remove to run test")
32 40
     @Test
33 41
     public void singPenultimateVerse() {
34 42
         assertEquals("1 bottle of beer on the wall, 1 bottle of beer.\n" +
35 43
                         "Take it down and pass it around, no more bottles of beer on the wall.\n\n",
36
-                BeerSong.verse(1));
44
+                beerSong.verse(1));
37 45
     }
38 46
 
39
-    @Ignore
47
+    @Ignore("Remove to run test")
40 48
     @Test
41 49
     public void singLastVerse() {
42 50
         assertEquals("No more bottles of beer on the wall, no more bottles of beer.\n" +
43 51
                         "Go to the store and buy some more, 99 bottles of beer on the wall.\n\n",
44
-                BeerSong.verse(0));
52
+                beerSong.verse(0));
45 53
     }
46 54
 
47
-    @Ignore
55
+    @Ignore("Remove to run test")
48 56
     @Test
49 57
     public void singLastFourVerses() {
50 58
         assertEquals("3 bottles of beer on the wall, 3 bottles of beer.\n" +
@@ -55,10 +63,10 @@ public class BeerSongTest {
55 63
                         "Take it down and pass it around, no more bottles of beer on the wall.\n\n" +
56 64
                         "No more bottles of beer on the wall, no more bottles of beer.\n" +
57 65
                         "Go to the store and buy some more, 99 bottles of beer on the wall.\n\n",
58
-                BeerSong.sing(3,0));
66
+                beerSong.sing(3,0));
59 67
     }
60 68
 
61
-    @Ignore
69
+    @Ignore("Remove to run test")
62 70
     @Test
63 71
     public void singEntireSong() {
64 72
         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" +
@@ -161,7 +169,7 @@ public class BeerSongTest {
161 169
                         "2 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\n" +
162 170
                         "1 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\n" +
163 171
                         "No 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",
164
-                BeerSong.singSong());
172
+                beerSong.singSong());
165 173
     }
166 174
 
167 175
 }

+ 41
- 41
exercises/binary-search-tree/src/test/java/BSTTest.java Dosyayı Görüntüle

@@ -11,26 +11,26 @@ public class BSTTest {
11 11
 
12 12
     @Test
13 13
     public void dataIsRetained() {
14
-        BST<Integer> sut = new BST();
14
+        BST<Integer> bst = new BST();
15 15
         final int actual = 4;
16
-        sut.insert(actual);
17
-        final BST.Node<Integer> root = sut.getRoot();
16
+        bst.insert(actual);
17
+        final BST.Node<Integer> root = bst.getRoot();
18 18
         assertNotNull(root);
19 19
         final int expected = root.getData();
20 20
         assertEquals(expected, actual);
21 21
     }
22 22
 
23 23
     @Test
24
-    @Ignore
24
+    @Ignore("Remove to run test")
25 25
     public void insertsLess() {
26
-        BST<Integer> sut = new BST();
26
+        BST<Integer> bst = new BST();
27 27
         final int expectedRoot = 4;
28 28
         final int expectedLeft = 2;
29 29
 
30
-        sut.insert(expectedRoot);
31
-        sut.insert(expectedLeft);
30
+        bst.insert(expectedRoot);
31
+        bst.insert(expectedLeft);
32 32
 
33
-        final BST.Node<Integer> root = sut.getRoot();
33
+        final BST.Node<Integer> root = bst.getRoot();
34 34
         assertNotNull(root);
35 35
         final BST.Node<Integer> left = root.getLeft();
36 36
         assertNotNull(left);
@@ -42,16 +42,16 @@ public class BSTTest {
42 42
     }
43 43
 
44 44
     @Test
45
-    @Ignore
45
+    @Ignore("Remove to run test")
46 46
     public void insertsSame() {
47
-        BST<Integer> sut = new BST();
47
+        BST<Integer> bst = new BST();
48 48
         final int expectedRoot = 4;
49 49
         final int expectedLeft = 4;
50 50
 
51
-        sut.insert(expectedRoot);
52
-        sut.insert(expectedLeft);
51
+        bst.insert(expectedRoot);
52
+        bst.insert(expectedLeft);
53 53
 
54
-        final BST.Node<Integer> root = sut.getRoot();
54
+        final BST.Node<Integer> root = bst.getRoot();
55 55
         assertNotNull(root);
56 56
         final BST.Node<Integer> left = root.getLeft();
57 57
         assertNotNull(left);
@@ -63,16 +63,16 @@ public class BSTTest {
63 63
     }
64 64
 
65 65
     @Test
66
-    @Ignore
66
+    @Ignore("Remove to run test")
67 67
     public void insertsRight() {
68
-        BST<Integer> sut = new BST();
68
+        BST<Integer> bst = new BST();
69 69
         final int expectedRoot = 4;
70 70
         final int expectedRight = 5;
71 71
 
72
-        sut.insert(expectedRoot);
73
-        sut.insert(expectedRight);
72
+        bst.insert(expectedRoot);
73
+        bst.insert(expectedRight);
74 74
 
75
-        final BST.Node<Integer> root = sut.getRoot();
75
+        final BST.Node<Integer> root = bst.getRoot();
76 76
         assertNotNull(root);
77 77
         final BST.Node<Integer> right = root.getRight();
78 78
         assertNotNull(right);
@@ -84,9 +84,9 @@ public class BSTTest {
84 84
     }
85 85
 
86 86
     @Test
87
-    @Ignore
87
+    @Ignore("Remove to run test")
88 88
     public void createsComplexTree() {
89
-        BST<Integer> sut = new BST<>();
89
+        BST<Integer> bst = new BST<>();
90 90
         List<Integer> expected = Collections.unmodifiableList(
91 91
                 Arrays.asList(4, 2, 6, 1, 3, 5, 7)
92 92
         );
@@ -94,60 +94,60 @@ public class BSTTest {
94 94
         List<Integer> treeData = Collections.unmodifiableList(
95 95
                 Arrays.asList(4, 2, 6, 1, 3, 7, 5)
96 96
         );
97
-        treeData.forEach(value -> sut.insert(value));
97
+        treeData.forEach(bst::insert);
98 98
 
99
-        List<Integer> actual = sut.getAsLevelOrderList();
99
+        List<Integer> actual = bst.getAsLevelOrderList();
100 100
         assertEquals(expected, actual);
101 101
     }
102 102
 
103 103
     @Test
104
-    @Ignore
104
+    @Ignore("Remove to run test")
105 105
     public void sortsSingleElement() {
106
-        BST<Integer> sut = new BST<>();
106
+        BST<Integer> bst = new BST<>();
107 107
         List<Integer> expected = Collections.unmodifiableList(
108
-                Arrays.asList(4)
108
+                Collections.singletonList(4)
109 109
         );
110 110
 
111
-        sut.insert(4);
111
+        bst.insert(4);
112 112
 
113
-        List<Integer> actual = sut.getAsSortedList();
113
+        List<Integer> actual = bst.getAsSortedList();
114 114
         assertEquals(expected, actual);
115 115
     }
116 116
 
117 117
     @Test
118
-    @Ignore
118
+    @Ignore("Remove to run test")
119 119
     public void sortsCollectionOfTwoIfSecondInsertedIsSmallerThanFirst() {
120
-        BST<Integer> sut = new BST<>();
120
+        BST<Integer> bst = new BST<>();
121 121
         List<Integer> expected = Collections.unmodifiableList(
122 122
                 Arrays.asList(2, 4)
123 123
         );
124 124
 
125
-        sut.insert(4);
126
-        sut.insert(2);
125
+        bst.insert(4);
126
+        bst.insert(2);
127 127
 
128
-        List<Integer> actual = sut.getAsSortedList();
128
+        List<Integer> actual = bst.getAsSortedList();
129 129
         assertEquals(expected, actual);
130 130
     }
131 131
 
132 132
     @Test
133
-    @Ignore
133
+    @Ignore("Remove to run test")
134 134
     public void sortsCollectionOfTwoIfSecondInsertedIsBiggerThanFirst() {
135
-        BST<Integer> sut = new BST<>();
135
+        BST<Integer> bst = new BST<>();
136 136
         List<Integer> expected = Collections.unmodifiableList(
137 137
                 Arrays.asList(4, 5)
138 138
         );
139 139
 
140
-        sut.insert(4);
141
-        sut.insert(5);
140
+        bst.insert(4);
141
+        bst.insert(5);
142 142
 
143
-        List<Integer> actual = sut.getAsSortedList();
143
+        List<Integer> actual = bst.getAsSortedList();
144 144
         assertEquals(expected, actual);
145 145
     }
146 146
 
147 147
     @Test
148
-    @Ignore
148
+    @Ignore("Remove to run test")
149 149
     public void iteratesOverComplexTree() {
150
-        BST<Integer> sut = new BST<>();
150
+        BST<Integer> bst = new BST<>();
151 151
         List<Integer> expected = Collections.unmodifiableList(
152 152
                 Arrays.asList(1, 2, 3, 4, 5, 6, 7)
153 153
         );
@@ -155,9 +155,9 @@ public class BSTTest {
155 155
         List<Integer> treeData = Collections.unmodifiableList(
156 156
                 Arrays.asList(4, 2, 1, 3, 6, 7, 5)
157 157
         );
158
-        treeData.forEach(value -> sut.insert(value));
158
+        treeData.forEach(bst::insert);
159 159
 
160
-        List<Integer> actual = sut.getAsSortedList();
160
+        List<Integer> actual = bst.getAsSortedList();
161 161
         assertEquals(expected, actual);
162 162
     }
163 163
 }

+ 1
- 0
exercises/binary-search/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 79
- 87
exercises/binary-search/src/test/java/BinarySearchTest.java Dosyayı Görüntüle

@@ -1,136 +1,128 @@
1 1
 
2
+import org.junit.Ignore;
3
+import org.junit.Test;
4
+
2 5
 import java.util.ArrayList;
3 6
 import java.util.Arrays;
4 7
 import java.util.Collections;
5 8
 import java.util.List;
9
+
6 10
 import static org.junit.Assert.assertEquals;
7
-import org.junit.Ignore;
8
-import org.junit.Test;
9 11
 
10 12
 public class BinarySearchTest {
11 13
 
12
-    public static final List<Integer> EMPTY_LIST
13
-            = Collections.unmodifiableList(new ArrayList<Integer>(0));
14
-
15
-    public static final List<Integer> LIST_OF_UNIT_LENGTH
16
-            = Collections.unmodifiableList(
17
-                    Arrays.asList(6)
18
-            );
19
-
20
-    private static final List<Integer> SORTED_LIST
21
-            = Collections.unmodifiableList(
22
-                    Arrays.asList(1, 3, 4, 6, 8, 9, 11)
23
-            );
24
-
25
-    public static final List<Integer> SORTED_LIST_OF_ODD_LENGTH
26
-            = Collections.unmodifiableList(
27
-                    Arrays.asList(1, 3, 5, 8, 13, 21, 34, 55,
28
-                            89, 144, 233, 377, 634)
29
-            );
30
-
31
-    public static final List<Integer> SORTED_LIST_OF_EVEN_LENGTH
32
-            = Collections.unmodifiableList(
33
-                    Arrays.asList(1, 3, 5, 8, 13, 21, 34, 55,
34
-                            89, 144, 233, 377)
35
-            );
36
-
37 14
     @Test
38 15
     public void findsAValueInAnArrayWithOneElement() {
39
-        BinarySearch<Integer> sut = new BinarySearch<>(LIST_OF_UNIT_LENGTH);
40
-        final int value = 6;
41
-        final int actual = sut.indexOf(value);
42
-        final int expected = 0;
43
-        assertEquals(expected, actual);
16
+        List<Integer> listOfUnitLength = Collections.singletonList(6);
17
+
18
+        BinarySearch<Integer> search = new BinarySearch<>(listOfUnitLength);
19
+
20
+        assertEquals(0, search.indexOf(6));
44 21
     }
45 22
 
46
-    @Ignore
23
+    @Ignore("Remove to run test")
47 24
     @Test
48 25
     public void findsAValueInTheMiddleOfAnArray() {
49
-        BinarySearch<Integer> sut = new BinarySearch<>(SORTED_LIST);
50
-        final int value = 6;
51
-        final int actual = sut.indexOf(value);
52
-        final int expected = 3;
53
-        assertEquals(expected, actual);
26
+        List<Integer> sortedList = Collections.unmodifiableList(
27
+                Arrays.asList(1, 3, 4, 6, 8, 9, 11)
28
+        );
29
+
30
+        BinarySearch<Integer> search = new BinarySearch<>(sortedList);
31
+
32
+        assertEquals(3, search.indexOf(6));
54 33
     }
55 34
 
56
-    @Ignore
35
+    @Ignore("Remove to run test")
57 36
     @Test
58 37
     public void findsAValueAtTheBeginningOfAnArray() {
59
-        BinarySearch<Integer> sut = new BinarySearch<>(SORTED_LIST);
60
-        final int value = 1;
61
-        final int actual = sut.indexOf(value);
62
-        final int expected = 0;
63
-        assertEquals(expected, actual);
38
+        List<Integer> sortedList = Collections.unmodifiableList(
39
+                Arrays.asList(1, 3, 4, 6, 8, 9, 11)
40
+        );
41
+
42
+        BinarySearch<Integer> search = new BinarySearch<>(sortedList);
43
+
44
+        assertEquals(0, search.indexOf(1));
64 45
     }
65 46
 
66
-    @Ignore
47
+    @Ignore("Remove to run test")
67 48
     @Test
68 49
     public void findsAValueAtTheEndOfAnArray() {
69
-        BinarySearch<Integer> sut = new BinarySearch<>(SORTED_LIST);
70
-        final int value = 11;
71
-        final int actual = sut.indexOf(value);
72
-        final int expected = 6;
73
-        assertEquals(expected, actual);
50
+        List<Integer> sortedList = Collections.unmodifiableList(
51
+                Arrays.asList(1, 3, 4, 6, 8, 9, 11)
52
+        );
53
+
54
+        BinarySearch<Integer> search = new BinarySearch<>(sortedList);
55
+
56
+        assertEquals(6, search.indexOf(11));
74 57
     }
75 58
 
76
-    @Ignore
59
+    @Ignore("Remove to run test")
77 60
     @Test
78 61
     public void findsAValueInAnArrayOfOddLength() {
79
-        BinarySearch<Integer> sut = new BinarySearch<>(SORTED_LIST_OF_ODD_LENGTH);
80
-        final int value = 144;
81
-        final int actual = sut.indexOf(value);
82
-        final int expected = 9;
83
-        assertEquals(expected, actual);
62
+        List<Integer> sortedListOfOddLength = Collections.unmodifiableList(
63
+                Arrays.asList(1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 634)
64
+        );
65
+
66
+        BinarySearch<Integer> search = new BinarySearch<>(sortedListOfOddLength);
67
+
68
+        assertEquals(9, search.indexOf(144));
84 69
     }
85 70
 
86
-    @Ignore
71
+    @Ignore("Remove to run test")
87 72
     @Test
88 73
     public void findsAValueInAnArrayOfEvenLength() {
89
-        BinarySearch<Integer> sut
90
-                = new BinarySearch<>(SORTED_LIST_OF_EVEN_LENGTH);
91
-        final int value = 21;
92
-        final int actual = sut.indexOf(value);
93
-        final int expected = 5;
94
-        assertEquals(expected, actual);
74
+        List<Integer> sortedListOfEvenLength = Collections.unmodifiableList(
75
+                Arrays.asList(1, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377)
76
+        );
77
+
78
+        BinarySearch<Integer> search = new BinarySearch<>(sortedListOfEvenLength);
79
+
80
+        assertEquals(5, search.indexOf(21));
95 81
     }
96 82
 
97
-    @Ignore
83
+    @Ignore("Remove to run test")
98 84
     @Test
99 85
     public void identifiesThatAValueIsNotIncludedInTheArray() {
100
-        BinarySearch<Integer> sut = new BinarySearch<>(SORTED_LIST);
101
-        final int value = 7;
102
-        final int actual = sut.indexOf(value);
103
-        final int expected = -1;
104
-        assertEquals(expected, actual);
86
+        List<Integer> sortedList = Collections.unmodifiableList(
87
+                Arrays.asList(1, 3, 4, 6, 8, 9, 11)
88
+        );
89
+
90
+        BinarySearch<Integer> search = new BinarySearch<>(sortedList);
91
+
92
+        assertEquals(-1, search.indexOf(7));
105 93
     }
106 94
 
107
-    @Ignore
95
+    @Ignore("Remove to run test")
108 96
     @Test
109 97
     public void aValueSmallerThanTheArraysSmallestValueIsNotIncluded() {
110
-        BinarySearch<Integer> sut = new BinarySearch<>(SORTED_LIST);
111
-        final int value = 0;
112
-        final int actual = sut.indexOf(value);
113
-        final int expected = -1;
114
-        assertEquals(expected, actual);
98
+        List<Integer> sortedList = Collections.unmodifiableList(
99
+                Arrays.asList(1, 3, 4, 6, 8, 9, 11)
100
+        );
101
+
102
+        BinarySearch<Integer> search = new BinarySearch<>(sortedList);
103
+
104
+        assertEquals(-1, search.indexOf(0));
115 105
     }
116 106
 
117
-    @Ignore
107
+    @Ignore("Remove to run test")
118 108
     @Test
119 109
     public void aValueLargerThanTheArraysSmallestValueIsNotIncluded() {
120
-        BinarySearch<Integer> sut = new BinarySearch<>(SORTED_LIST);
121
-        final int value = 13;
122
-        final int actual = sut.indexOf(value);
123
-        final int expected = -1;
124
-        assertEquals(expected, actual);
110
+        List<Integer> sortedList = Collections.unmodifiableList(
111
+                Arrays.asList(1, 3, 4, 6, 8, 9, 11)
112
+        );
113
+
114
+        BinarySearch<Integer> search = new BinarySearch<>(sortedList);
115
+
116
+        assertEquals(-1, search.indexOf(13));
125 117
     }
126 118
 
127
-    @Ignore
119
+    @Ignore("Remove to run test")
128 120
     @Test
129 121
     public void nothingIsIncludedInAnEmptyArray() {
130
-        BinarySearch<Integer> sut = new BinarySearch<>(EMPTY_LIST);
131
-        final int value = 1;
132
-        final int actual = sut.indexOf(value);
133
-        final int expected = -1;
134
-        assertEquals(expected, actual);
122
+        List<Integer> emptyList = Collections.emptyList();
123
+
124
+        BinarySearch<Integer> search = new BinarySearch<>(emptyList);
125
+
126
+        assertEquals(-1, search.indexOf(1));
135 127
     }
136 128
 }

+ 1
- 0
exercises/binary/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 1
- 0
exercises/bob/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 17
- 17
exercises/bob/src/test/java/BobTest.java Dosyayı Görüntüle

@@ -15,7 +15,7 @@ public class BobTest {
15 15
         );
16 16
     }
17 17
 
18
-    @Ignore
18
+    @Ignore("Remove to run test")
19 19
     @Test
20 20
     public void shouting() {
21 21
         assertEquals(
@@ -24,7 +24,7 @@ public class BobTest {
24 24
         );
25 25
     }
26 26
 
27
-    @Ignore
27
+    @Ignore("Remove to run test")
28 28
     @Test
29 29
     public void askingAQuestion() {
30 30
         assertEquals(
@@ -33,7 +33,7 @@ public class BobTest {
33 33
         );
34 34
     }
35 35
 
36
-    @Ignore
36
+    @Ignore("Remove to run test")
37 37
     @Test
38 38
     public void askingANumericQuestion() {
39 39
         assertEquals(
@@ -42,7 +42,7 @@ public class BobTest {
42 42
         );
43 43
     }
44 44
 
45
-    @Ignore
45
+    @Ignore("Remove to run test")
46 46
     @Test
47 47
     public void talkingForcefully() {
48 48
         assertEquals(
@@ -51,7 +51,7 @@ public class BobTest {
51 51
         );
52 52
     }
53 53
 
54
-    @Ignore
54
+    @Ignore("Remove to run test")
55 55
     @Test
56 56
     public void usingAcronymsInRegularSpeech() {
57 57
         assertEquals(
@@ -59,7 +59,7 @@ public class BobTest {
59 59
         );
60 60
     }
61 61
 
62
-    @Ignore
62
+    @Ignore("Remove to run test")
63 63
     @Test
64 64
     public void forcefulQuestions() {
65 65
         assertEquals(
@@ -67,7 +67,7 @@ public class BobTest {
67 67
         );
68 68
     }
69 69
 
70
-    @Ignore
70
+    @Ignore("Remove to run test")
71 71
     @Test
72 72
     public void shoutingNumbers() {
73 73
         assertEquals(
@@ -75,7 +75,7 @@ public class BobTest {
75 75
         );
76 76
     }
77 77
 
78
-    @Ignore
78
+    @Ignore("Remove to run test")
79 79
     @Test
80 80
     public void onlyNumbers() {
81 81
         assertEquals(
@@ -83,7 +83,7 @@ public class BobTest {
83 83
         );
84 84
     }
85 85
 
86
-    @Ignore
86
+    @Ignore("Remove to run test")
87 87
     @Test
88 88
     public void questionWithOnlyNumbers() {
89 89
         assertEquals(
@@ -91,7 +91,7 @@ public class BobTest {
91 91
         );
92 92
     }
93 93
 
94
-    @Ignore
94
+    @Ignore("Remove to run test")
95 95
     @Test
96 96
     public void shoutingWithSpecialCharacters() {
97 97
         assertEquals(
@@ -99,7 +99,7 @@ public class BobTest {
99 99
         );
100 100
     }
101 101
 
102
-    @Ignore
102
+    @Ignore("Remove to run test")
103 103
     @Test
104 104
     public void shoutingWithUmlauts() {
105 105
         assertEquals(
@@ -107,7 +107,7 @@ public class BobTest {
107 107
         );
108 108
     }
109 109
 
110
-    @Ignore
110
+    @Ignore("Remove to run test")
111 111
     @Test
112 112
     public void calmlySpeakingWithUmlauts() {
113 113
         assertEquals(
@@ -115,7 +115,7 @@ public class BobTest {
115 115
         );
116 116
     }
117 117
 
118
-    @Ignore
118
+    @Ignore("Remove to run test")
119 119
     @Test
120 120
     public void shoutingWithNoExclamationMark() {
121 121
         assertEquals(
@@ -123,7 +123,7 @@ public class BobTest {
123 123
         );
124 124
     }
125 125
 
126
-    @Ignore
126
+    @Ignore("Remove to run test")
127 127
     @Test
128 128
     public void statementContainingQuestionMark() {
129 129
         assertEquals(
@@ -131,7 +131,7 @@ public class BobTest {
131 131
         );
132 132
     }
133 133
 
134
-    @Ignore
134
+    @Ignore("Remove to run test")
135 135
     @Test
136 136
     public void prattlingOn() {
137 137
         assertEquals(
@@ -139,7 +139,7 @@ public class BobTest {
139 139
         );
140 140
     }
141 141
 
142
-    @Ignore
142
+    @Ignore("Remove to run test")
143 143
     @Test
144 144
     public void silence() {
145 145
         assertEquals(
@@ -147,7 +147,7 @@ public class BobTest {
147 147
         );
148 148
     }
149 149
 
150
-    @Ignore
150
+    @Ignore("Remove to run test")
151 151
     @Test
152 152
     public void prolongedSilence() {
153 153
         assertEquals(

+ 18
- 0
exercises/book-store/build.gradle Dosyayı Görüntüle

@@ -0,0 +1,18 @@
1
+apply plugin: "java"
2
+apply plugin: "eclipse"
3
+apply plugin: "idea"
4
+
5
+repositories {
6
+  mavenCentral()
7
+}
8
+
9
+dependencies {
10
+  testCompile "junit:junit:4.12"
11
+}
12
+
13
+test {
14
+  testLogging {
15
+    exceptionFormat = 'full'
16
+    events = ["passed", "failed", "skipped"]
17
+  }
18
+}

exercises/gigasecond/src/main/java/.keep → exercises/book-store/src/example/java/.keep Dosyayı Görüntüle


+ 50
- 0
exercises/book-store/src/example/java/BookStore.java Dosyayı Görüntüle

@@ -0,0 +1,50 @@
1
+import java.util.ArrayList;
2
+import java.util.List;
3
+import java.util.stream.Collectors;
4
+
5
+class BookStore {
6
+
7
+  private static final int BOOK_PRICE = 8, MAX_GROUP_SIZE = 5;
8
+
9
+  private static double[] DISCOUNT_TIERS = {0, 5, 10, 20, 25};
10
+
11
+  double calculateBasketCost(final List<Integer> books) {
12
+    return calculateBasketCost(books, 0);
13
+  }
14
+
15
+  private double calculateBasketCost(final List<Integer> books, final double priceSoFar) {
16
+    if (books.size() == 0) {
17
+      return priceSoFar;
18
+    }
19
+
20
+    List<Integer> availableBookNumbers = books.stream()
21
+        .distinct()
22
+        .collect(Collectors.toList());
23
+
24
+    double minPrice = Double.MAX_VALUE;
25
+
26
+    for (int i = 0; i < availableBookNumbers.size(); i++) {
27
+      List<Integer> newGroupBooks = new ArrayList<>(availableBookNumbers.subList(0, i + 1));
28
+      List<Integer> remainingBooks = new ArrayList<>(books);
29
+
30
+      for (final Integer newGroupBook : newGroupBooks) {
31
+        //noinspection UseBulkOperation - we want to remove _one_ of each book number, not _all_ of each book number.
32
+        remainingBooks.remove(newGroupBook);
33
+      }
34
+
35
+      double price = calculateBasketCost(remainingBooks, priceSoFar + costOfGroupSize(newGroupBooks.size()));
36
+      minPrice = Math.min(minPrice, price);
37
+    }
38
+
39
+    return minPrice;
40
+  }
41
+
42
+  private double costOfGroupSize(int groupSize) {
43
+    if (groupSize < 1 || groupSize > MAX_GROUP_SIZE) {
44
+      throw new IllegalStateException("Invalid group size : " + groupSize);
45
+    }
46
+
47
+    return BOOK_PRICE * groupSize * (100 - DISCOUNT_TIERS[groupSize - 1]) / 100;
48
+  }
49
+
50
+}

exercises/binary-search/src/main/java/.keep → exercises/book-store/src/main/java/.keep Dosyayı Görüntüle


exercises/binary-search-tree/src/test/java/.keep → exercises/book-store/src/test/java/.keep Dosyayı Görüntüle


+ 113
- 0
exercises/book-store/src/test/java/BookStoreTest.java Dosyayı Görüntüle

@@ -0,0 +1,113 @@
1
+import static org.junit.Assert.assertEquals;
2
+
3
+import java.util.Collections;
4
+import java.util.List;
5
+import java.util.Arrays;
6
+
7
+import org.junit.Before;
8
+import org.junit.Ignore;
9
+import org.junit.Test;
10
+
11
+public class BookStoreTest {
12
+
13
+  // This is sufficient accuracy since we're handling currency values, which should be equal to within 2 decimal places.
14
+  private static final double EQUALITY_TOLERANCE = 0.001;
15
+
16
+  private BookStore bookStore;
17
+
18
+  @Before
19
+  public void setUp() {
20
+    bookStore = new BookStore();
21
+  }
22
+
23
+  @Test
24
+  public void onlyASingleBook() {
25
+    List<Integer> books = Collections.singletonList(1);
26
+    assertEquals(8, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
27
+  }
28
+
29
+  @Ignore("Remove to run test")
30
+  @Test
31
+  public void twoOfSameBook() {
32
+    List<Integer> books = Arrays.asList(1, 1);
33
+    assertEquals(16, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
34
+  }
35
+
36
+  @Ignore("Remove to run test")
37
+  @Test
38
+  public void emptyBasket() {
39
+    List<Integer> books = Collections.emptyList();
40
+    assertEquals(0, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
41
+  }
42
+
43
+  @Ignore("Remove to run test")
44
+  @Test
45
+  public void twoDifferentBooks() {
46
+    List<Integer> books = Arrays.asList(1, 2);
47
+    assertEquals(15.20, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
48
+  }
49
+
50
+  @Ignore("Remove to run test")
51
+  @Test
52
+  public void threeDifferentBooks() {
53
+    List<Integer> books = Arrays.asList(1, 2, 3);
54
+    assertEquals(21.6, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
55
+  }
56
+
57
+  @Ignore("Remove to run test")
58
+  @Test
59
+  public void fourDifferentBooks() {
60
+    List<Integer> books = Arrays.asList(1, 2, 3, 4);
61
+    assertEquals(25.6, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
62
+  }
63
+
64
+  @Ignore("Remove to run test")
65
+  @Test
66
+  public void fiveDifferentBooks() {
67
+    List<Integer> books = Arrays.asList(1, 2, 3, 4, 5);
68
+    assertEquals(30, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
69
+  }
70
+
71
+  @Ignore("Remove to run test")
72
+  @Test
73
+  public void twoGroupsOfFourIsCheaperThanGroupOfFivePlusGroupOfThree() {
74
+    List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 5);
75
+    assertEquals(51.20, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
76
+  }
77
+
78
+  @Ignore("Remove to run test")
79
+  @Test
80
+  public void groupOfFourPlusGroupOfTwoIsCheaperThanTwoGroupsOfThree() {
81
+    List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 4);
82
+    assertEquals(40.8, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
83
+  }
84
+
85
+  @Ignore("Remove to run test")
86
+  @Test
87
+  public void twoEachOfFirst4BooksAnd1CopyEachOfRest() {
88
+    List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 4, 5);
89
+    assertEquals(55.60, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
90
+  }
91
+
92
+  @Ignore("Remove to run test")
93
+  @Test
94
+  public void twoCopiesOfEachBook() {
95
+    List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 4, 5, 5);
96
+    assertEquals(60.00, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
97
+  }
98
+
99
+  @Ignore("Remove to run test")
100
+  @Test
101
+  public void threeCopiesOfFirstBookAnd2EachOfRemaining() {
102
+    List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1);
103
+    assertEquals(68.00, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
104
+  }
105
+
106
+  @Ignore("Remove to run test")
107
+  @Test
108
+  public void threeEachOFirst2BooksAnd2EachOfRemainingBooks() {
109
+    List<Integer> books = Arrays.asList(1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2);
110
+    assertEquals(75.20, bookStore.calculateBasketCost(books), EQUALITY_TOLERANCE);
111
+  }
112
+
113
+}

+ 1
- 0
exercises/bracket-push/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 1
- 1
exercises/bracket-push/src/main/java/BracketChecker.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-final class BracketChecker {
1
+class BracketChecker {
2 2
 
3 3
 
4 4
 

+ 13
- 13
exercises/bracket-push/src/test/java/BracketCheckerTest.java Dosyayı Görüntüle

@@ -5,7 +5,7 @@ import static org.junit.Assert.assertEquals;
5 5
 import static org.junit.Assert.assertFalse;
6 6
 import static org.junit.Assert.assertTrue;
7 7
 
8
-public final class BracketCheckerTest {
8
+public class BracketCheckerTest {
9 9
 
10 10
     @Test
11 11
     public void testPairedSquareBrackets() {
@@ -13,84 +13,84 @@ public final class BracketCheckerTest {
13 13
         assertTrue(bracketChecker.areBracketsMatchedAndNestedCorrectly());
14 14
     }
15 15
 
16
-    @Ignore
16
+    @Ignore("Remove to run test")
17 17
     @Test
18 18
     public void testEmptyString() {
19 19
         final BracketChecker bracketChecker = new BracketChecker("");
20 20
         assertTrue(bracketChecker.areBracketsMatchedAndNestedCorrectly());
21 21
     }
22 22
 
23
-    @Ignore
23
+    @Ignore("Remove to run test")
24 24
     @Test
25 25
     public void testUnpairedBrackets() {
26 26
         final BracketChecker bracketChecker = new BracketChecker("[[");
27 27
         assertFalse(bracketChecker.areBracketsMatchedAndNestedCorrectly());
28 28
     }
29 29
 
30
-    @Ignore
30
+    @Ignore("Remove to run test")
31 31
     @Test
32 32
     public void testIncorrectlyOrderedBrackets() {
33 33
         final BracketChecker bracketChecker = new BracketChecker("}{");
34 34
         assertFalse(bracketChecker.areBracketsMatchedAndNestedCorrectly());
35 35
     }
36 36
 
37
-    @Ignore
37
+    @Ignore("Remove to run test")
38 38
     @Test
39 39
     public void testPairedBracketsWithWhitespace() {
40 40
         final BracketChecker bracketChecker = new BracketChecker("{ }");
41 41
         assertTrue(bracketChecker.areBracketsMatchedAndNestedCorrectly());
42 42
     }
43 43
 
44
-    @Ignore
44
+    @Ignore("Remove to run test")
45 45
     @Test
46 46
     public void testSimpleNestedBrackets() {
47 47
         final BracketChecker bracketChecker = new BracketChecker("{[]}");
48 48
         assertTrue(bracketChecker.areBracketsMatchedAndNestedCorrectly());
49 49
     }
50 50
 
51
-    @Ignore
51
+    @Ignore("Remove to run test")
52 52
     @Test
53 53
     public void testSeveralPairedBrackets() {
54 54
         final BracketChecker bracketChecker = new BracketChecker("{}[]");
55 55
         assertTrue(bracketChecker.areBracketsMatchedAndNestedCorrectly());
56 56
     }
57 57
 
58
-    @Ignore
58
+    @Ignore("Remove to run test")
59 59
     @Test
60 60
     public void testPairedAndNestedBrackets() {
61 61
         final BracketChecker bracketChecker = new BracketChecker("([{}({}[])])");
62 62
         assertTrue(bracketChecker.areBracketsMatchedAndNestedCorrectly());
63 63
     }
64 64
 
65
-    @Ignore
65
+    @Ignore("Remove to run test")
66 66
     @Test
67 67
     public void testUnopenedClosingBracket() {
68 68
         final BracketChecker bracketChecker = new BracketChecker("{[)][]}");
69 69
         assertFalse(bracketChecker.areBracketsMatchedAndNestedCorrectly());
70 70
     }
71 71
 
72
-    @Ignore
72
+    @Ignore("Remove to run test")
73 73
     @Test
74 74
     public void testUnpairedAndNestedBracket() {
75 75
         final BracketChecker bracketChecker = new BracketChecker("([{])");
76 76
         assertFalse(bracketChecker.areBracketsMatchedAndNestedCorrectly());
77 77
     }
78 78
 
79
-    @Ignore
79
+    @Ignore("Remove to run test")
80 80
     @Test
81 81
     public void testPairedAndIncorrectlyNestedBrackets() {
82 82
         final BracketChecker bracketChecker = new BracketChecker("[({]})");
83 83
         assertFalse(bracketChecker.areBracketsMatchedAndNestedCorrectly());
84 84
     }
85 85
 
86
-    @Ignore
86
+    @Ignore("Remove to run test")
87 87
     @Test
88 88
     public void testValidMathExpression() {
89 89
         final BracketChecker bracketChecker = new BracketChecker("(((185 + 223.85) * 15) - 543)/2");
90 90
         assertTrue(bracketChecker.areBracketsMatchedAndNestedCorrectly());
91 91
     }
92 92
 
93
-    @Ignore
93
+    @Ignore("Remove to run test")
94 94
     @Test
95 95
     public void testValidComplexLaTeXExpression() {
96 96
         final BracketChecker bracketChecker = new BracketChecker(

+ 57
- 31
exercises/build.gradle Dosyayı Görüntüle

@@ -1,41 +1,67 @@
1
-subprojects { project ->
2
-  apply plugin: "java"
3
-
4
-  sourceSets {
5
-    // Verify that the tests are working by running them against the example code.
6
-    // By replacing the "main" sourceSet with the example code we avoid any collisions
7
-    //   with solution code that may have been included as a "starter" (e.g. etl).
8
-    main {
9
-      java.srcDirs = ["src/example/java"]
10
-    }
11
-    project["compileJava"].doFirst { compileTask ->
12
-      println "  (source = " + compileTask.source.asPath + ")"
13
-    }
1
+// This root Gradle project is used for:
2
+//
3
+// - Checking that every test suite compiles against its corresponding example implementation;
4
+// - Checking that every example implementation passes its corresponding test suite;
5
+// - Checking that every provided starter implementation compiles.
6
+//
7
+// This file is never delivered to Exercism users.
14 8
 
15
-    starterSource {
16
-      java.srcDirs = ["src/main/java"]
17
-    }
18
-    project["compileStarterSourceJava"].doFirst { compileTask ->
19
-      println "  (source = " + compileTask.source.asPath + ")"
20
-    }
9
+def generatedTestSourceDir = "build/gen/test/java"
21 10
 
22
-    // In lieu of being able to disable @Ignore in JUnit tests, we filter
23
-    // those annotations, placing the edited tests in the path named here.
24
-    test {
25
-      java.srcDirs = ["build/gen/test/java"]
26
-    }
27
-    project["compileTestJava"].doFirst { compileTask ->
28
-      println "  (source = " + compileTask.source.asPath + ")"
29
-    }
30
-  }
11
+subprojects {
31 12
 
13
+  // Add a task that copies test source files into a build directory. All @Ignore annotations
14
+  // are removed during this copying, so that when we run the copied tests, none are skipped and
15
+  // all should execute.
16
+  //
17
+  // Note that journey-test.sh also strips @Ignore annotations using sed. The
18
+  // stripping implementations here and in journey-test.sh should be kept
19
+  // consistent.
32 20
   task copyTestsFilteringIgnores(type: Copy) {
33 21
     from "src/test/java"
34
-    into "build/gen/test/java"
22
+    into generatedTestSourceDir
35 23
     filter { line ->
36
-      line.contains("@Ignore") ? "" : line
24
+      line.contains("@Ignore") ? null : line
25
+    }
26
+  }
27
+
28
+  afterEvaluate { project ->
29
+
30
+    sourceSets {
31
+      // Set the directory containing the example implementation as the default source set. Default
32
+      // compile tasks will now run against this source set.
33
+      main {
34
+        java.srcDirs = ["src/example/java"]
35
+      }
36
+
37
+      // Define a custom source set named "starterSource" that points to the starter implementations
38
+      // delivered to users. We can then use the generated "compileStarterSourceJava" task to verify
39
+      // that the starter source compiles as-is.
40
+      starterSource {
41
+        java.srcDirs = ["src/main/java"]
42
+      }
43
+
44
+      // Set the directory containing the @Ignore-stripped tests as the default test source set.
45
+      // Default test tasks will now run against this source set.
46
+      test {
47
+        java.srcDirs = [generatedTestSourceDir]
48
+      }
49
+
50
+      // Log the source paths associated with each source set to verify they are what we expect.
51
+      logCompileTaskSourcePath(project, "compileJava") // Corresponds to the "main" source set.
52
+      logCompileTaskSourcePath(project, "compileStarterSourceJava")
53
+      logCompileTaskSourcePath(project, "compileTestJava")
37 54
     }
55
+
56
+    // When running the standard test task, make sure we prepopulate the test source set with the
57
+    // @Ignore-stripped tests.
58
+    test.dependsOn(copyTestsFilteringIgnores)
38 59
   }
39 60
 
40
-  test.dependsOn(copyTestsFilteringIgnores)
61
+}
62
+
63
+def logCompileTaskSourcePath(Project project, String taskName) {
64
+  project[taskName].doFirst { compileTask ->
65
+    println "  (source = ${compileTask.source.asPath})"
66
+  }
41 67
 }

+ 1
- 0
exercises/change/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 1
- 1
exercises/change/src/main/java/ChangeCalculator.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-final class ChangeCalculator {
1
+class ChangeCalculator {
2 2
 
3 3
 
4 4
 

+ 9
- 9
exercises/change/src/test/java/ChangeCalculatorTest.java Dosyayı Görüntüle

@@ -8,7 +8,7 @@ import static java.util.Collections.emptyList;
8 8
 import static java.util.Collections.singletonList;
9 9
 import static org.junit.Assert.assertEquals;
10 10
 
11
-public final class ChangeCalculatorTest {
11
+public class ChangeCalculatorTest {
12 12
 
13 13
     /*
14 14
      * See https://github.com/junit-team/junit4/wiki/Rules for information on JUnit Rules in general and
@@ -26,7 +26,7 @@ public final class ChangeCalculatorTest {
26 26
                 changeCalculator.computeMostEfficientChange(25));
27 27
     }
28 28
 
29
-    @Ignore
29
+    @Ignore("Remove to run test")
30 30
     @Test
31 31
     public void testChangeThatMustBeGivenInMultipleCoins() {
32 32
         ChangeCalculator changeCalculator = new ChangeCalculator(asList(1, 5, 10, 25, 100));
@@ -36,7 +36,7 @@ public final class ChangeCalculatorTest {
36 36
                 changeCalculator.computeMostEfficientChange(15));
37 37
     }
38 38
 
39
-    @Ignore
39
+    @Ignore("Remove to run test")
40 40
     @Test
41 41
     // https://en.wikipedia.org/wiki/Change-making_problem#Greedy_method
42 42
     public void testLilliputianCurrencyForWhichGreedyAlgorithmFails() {
@@ -47,7 +47,7 @@ public final class ChangeCalculatorTest {
47 47
                 changeCalculator.computeMostEfficientChange(23));
48 48
     }
49 49
 
50
-    @Ignore
50
+    @Ignore("Remove to run test")
51 51
     @Test
52 52
     // https://en.wikipedia.org/wiki/Change-making_problem#Greedy_method
53 53
     public void testLowerElbonianCurrencyForWhichGreedyAlgorithmFails() {
@@ -58,7 +58,7 @@ public final class ChangeCalculatorTest {
58 58
                 changeCalculator.computeMostEfficientChange(63));
59 59
     }
60 60
 
61
-    @Ignore
61
+    @Ignore("Remove to run test")
62 62
     @Test
63 63
     public void testLargeAmountOfChange() {
64 64
         ChangeCalculator changeCalculator = new ChangeCalculator(asList(1, 2, 5, 10, 20, 50, 100));
@@ -68,7 +68,7 @@ public final class ChangeCalculatorTest {
68 68
                 changeCalculator.computeMostEfficientChange(999));
69 69
     }
70 70
 
71
-    @Ignore
71
+    @Ignore("Remove to run test")
72 72
     @Test
73 73
     public void testZeroChange() {
74 74
         ChangeCalculator changeCalculator = new ChangeCalculator(asList(1, 5, 10, 21, 25));
@@ -78,7 +78,7 @@ public final class ChangeCalculatorTest {
78 78
                 changeCalculator.computeMostEfficientChange(0));
79 79
     }
80 80
 
81
-    @Ignore
81
+    @Ignore("Remove to run test")
82 82
     @Test
83 83
     public void testChangeLessThanSmallestCoinInCurrencyCannotBeRepresented() {
84 84
         ChangeCalculator changeCalculator = new ChangeCalculator(asList(5, 10));
@@ -89,7 +89,7 @@ public final class ChangeCalculatorTest {
89 89
         changeCalculator.computeMostEfficientChange(3);
90 90
     }
91 91
 
92
-    @Ignore
92
+    @Ignore("Remove to run test")
93 93
     @Test
94 94
     public void testChangeLargerThanAllCoinsInCurrencyThatCannotBeRepresented() {
95 95
         ChangeCalculator changeCalculator = new ChangeCalculator(asList(5, 10));
@@ -100,7 +100,7 @@ public final class ChangeCalculatorTest {
100 100
         changeCalculator.computeMostEfficientChange(94);
101 101
     }
102 102
 
103
-    @Ignore
103
+    @Ignore("Remove to run test")
104 104
     @Test
105 105
     public void testNegativeChangeIsRejected() {
106 106
         ChangeCalculator changeCalculator = new ChangeCalculator(asList(1, 2, 5));

+ 3
- 0
exercises/clock/HINT.md Dosyayı Görüntüle

@@ -0,0 +1,3 @@
1
+In order to satisfy the requirement that two clocks are considered equal just when they are set to the same time, you will need to override the [`equals`](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals(java.lang.Object)) and [`hashcode`](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode) methods in your `Clock` class.
2
+ 
3
+For more information on how to override these methods, see [this JavaWorld article](https://web.archive.org/web/20170528222153/http://www.javaworld.com/article/2072762/java-app-dev/object-equality.html).

+ 2
- 1
exercises/clock/build.gradle Dosyayı Görüntüle

@@ -9,9 +9,10 @@ repositories {
9 9
 dependencies {
10 10
     testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
     testLogging {
14 15
         exceptionFormat = 'full'
15 16
         events = ["passed", "failed", "skipped"]
16 17
     }
17
-}
18
+}

+ 19
- 16
exercises/clock/src/test/java/ClockAddTest.java Dosyayı Görüntüle

@@ -3,9 +3,12 @@ import org.junit.Test;
3 3
 
4 4
 import static org.junit.Assert.assertEquals;
5 5
 
6
+/*
7
+ * version: 1.0.1
8
+ */
6 9
 public class ClockAddTest {
7 10
 
8
-    @Ignore
11
+    @Ignore("Remove to run test")
9 12
     @Test
10 13
     public void addMinutes() {
11 14
         Clock clock = new Clock(10, 0);
@@ -13,7 +16,7 @@ public class ClockAddTest {
13 16
         assertEquals("10:03", clock.toString());
14 17
     }
15 18
 
16
-    @Ignore
19
+    @Ignore("Remove to run test")
17 20
     @Test
18 21
     public void addNoMinutes() {
19 22
         Clock clock = new Clock(6, 41);
@@ -21,7 +24,7 @@ public class ClockAddTest {
21 24
         assertEquals("06:41", clock.toString());
22 25
     }
23 26
 
24
-    @Ignore
27
+    @Ignore("Remove to run test")
25 28
     @Test
26 29
     public void addToNextHour() {
27 30
         Clock clock = new Clock(0, 45);
@@ -29,7 +32,7 @@ public class ClockAddTest {
29 32
         assertEquals("01:25", clock.toString());
30 33
     }
31 34
 
32
-    @Ignore
35
+    @Ignore("Remove to run test")
33 36
     @Test
34 37
     public void addMoreThanOneHour() {
35 38
         Clock clock = new Clock(10, 0);
@@ -37,7 +40,7 @@ public class ClockAddTest {
37 40
         assertEquals("11:01", clock.toString());
38 41
     }
39 42
 
40
-    @Ignore
43
+    @Ignore("Remove to run test")
41 44
     @Test
42 45
     public void addMoreThanTwoHoursWithCarry() {
43 46
         Clock clock = new Clock(0, 45);
@@ -45,7 +48,7 @@ public class ClockAddTest {
45 48
         assertEquals("03:25", clock.toString());
46 49
     }
47 50
 
48
-    @Ignore
51
+    @Ignore("Remove to run test")
49 52
     @Test
50 53
     public void addAcrossMidnight() {
51 54
         Clock clock = new Clock(23, 59);
@@ -53,7 +56,7 @@ public class ClockAddTest {
53 56
         assertEquals("00:01", clock.toString());
54 57
     }
55 58
 
56
-    @Ignore
59
+    @Ignore("Remove to run test")
57 60
     @Test
58 61
     public void addMoreThanOneDay() {
59 62
         Clock clock = new Clock(5, 32);
@@ -61,7 +64,7 @@ public class ClockAddTest {
61 64
         assertEquals("06:32", clock.toString());
62 65
     }
63 66
 
64
-    @Ignore
67
+    @Ignore("Remove to run test")
65 68
     @Test
66 69
     public void addMoreThanTwoDays() {
67 70
         Clock clock = new Clock(1, 1);
@@ -69,7 +72,7 @@ public class ClockAddTest {
69 72
         assertEquals("11:21", clock.toString());
70 73
     }
71 74
 
72
-    @Ignore
75
+    @Ignore("Remove to run test")
73 76
     @Test
74 77
     public void subtractMinutes() {
75 78
         Clock clock = new Clock(10, 3);
@@ -77,7 +80,7 @@ public class ClockAddTest {
77 80
         assertEquals("10:00", clock.toString());
78 81
     }
79 82
 
80
-    @Ignore
83
+    @Ignore("Remove to run test")
81 84
     @Test
82 85
     public void subtractToPreviousHour() {
83 86
         Clock clock = new Clock(10, 3);
@@ -85,7 +88,7 @@ public class ClockAddTest {
85 88
         assertEquals("09:33", clock.toString());
86 89
     }
87 90
 
88
-    @Ignore
91
+    @Ignore("Remove to run test")
89 92
     @Test
90 93
     public void subtractMoreThanAnHour() {
91 94
         Clock clock = new Clock(10, 3);
@@ -93,7 +96,7 @@ public class ClockAddTest {
93 96
         assertEquals("08:53", clock.toString());
94 97
     }
95 98
 
96
-    @Ignore
99
+    @Ignore("Remove to run test")
97 100
     @Test
98 101
     public void subtractAcrossMidnight() {
99 102
         Clock clock = new Clock(0, 3);
@@ -101,7 +104,7 @@ public class ClockAddTest {
101 104
         assertEquals("23:59", clock.toString());
102 105
     }
103 106
 
104
-    @Ignore
107
+    @Ignore("Remove to run test")
105 108
     @Test
106 109
     public void subtractMoreThanTwoHours() {
107 110
         Clock clock = new Clock(0, 0);
@@ -109,7 +112,7 @@ public class ClockAddTest {
109 112
         assertEquals("21:20", clock.toString());
110 113
     }
111 114
 
112
-    @Ignore
115
+    @Ignore("Remove to run test")
113 116
     @Test
114 117
     public void subtractMoreThanTwoHoursWithBorrow() {
115 118
         Clock clock = new Clock(6, 15);
@@ -117,7 +120,7 @@ public class ClockAddTest {
117 120
         assertEquals("03:35", clock.toString());
118 121
     }
119 122
 
120
-    @Ignore
123
+    @Ignore("Remove to run test")
121 124
     @Test
122 125
     public void subtractMoreThanOneDay() {
123 126
         Clock clock = new Clock(5, 32);
@@ -125,7 +128,7 @@ public class ClockAddTest {
125 128
         assertEquals("04:32", clock.toString());
126 129
     }
127 130
 
128
-    @Ignore
131
+    @Ignore("Remove to run test")
129 132
     @Test
130 133
     public void subtractMoreThanTwoDays() {
131 134
         Clock clock = new Clock(2, 20);

+ 21
- 18
exercises/clock/src/test/java/ClockCreationTest.java Dosyayı Görüntüle

@@ -3,6 +3,9 @@ import org.junit.Test;
3 3
 
4 4
 import static org.junit.Assert.assertEquals;
5 5
 
6
+/*
7
+ * version: 1.0.1
8
+ */
6 9
 public class ClockCreationTest {
7 10
 
8 11
     @Test
@@ -10,109 +13,109 @@ public class ClockCreationTest {
10 13
         assertEquals("08:00", new Clock(8, 0).toString());
11 14
     }
12 15
 
13
-    @Ignore
16
+    @Ignore("Remove to run test")
14 17
     @Test
15 18
     public void canPrintTimeWithMinutes() {
16 19
         assertEquals("11:09", new Clock(11, 9).toString());
17 20
     }
18 21
 
19
-    @Ignore
22
+    @Ignore("Remove to run test")
20 23
     @Test
21 24
     public void midnightPrintsAsZero() {
22 25
         assertEquals("00:00", new Clock(24, 0).toString());
23 26
     }
24 27
 
25
-    @Ignore
28
+    @Ignore("Remove to run test")
26 29
     @Test
27 30
     public void hourRollsOver() {
28 31
         assertEquals("01:00", new Clock(25, 0).toString());
29 32
     }
30 33
 
31
-    @Ignore
34
+    @Ignore("Remove to run test")
32 35
     @Test
33 36
     public void hourRollsOverContinuously() {
34 37
         assertEquals("04:00", new Clock(100, 0).toString());
35 38
     }
36 39
 
37
-    @Ignore
40
+    @Ignore("Remove to run test")
38 41
     @Test
39 42
     public void sixtyMinutesIsNextHour() {
40 43
         assertEquals("02:00", new Clock(1, 60).toString());
41 44
     }
42 45
 
43
-    @Ignore
46
+    @Ignore("Remove to run test")
44 47
     @Test
45 48
     public void minutesRollOver() {
46 49
         assertEquals("02:40", new Clock(0, 160).toString());
47 50
     }
48 51
 
49
-    @Ignore
52
+    @Ignore("Remove to run test")
50 53
     @Test
51 54
     public void minutesRollOverContinuously() {
52 55
         assertEquals("04:43", new Clock(0, 1723).toString());
53 56
     }
54 57
 
55
-    @Ignore
58
+    @Ignore("Remove to run test")
56 59
     @Test
57 60
     public void hourAndMinutesRollOver() {
58 61
         assertEquals("03:40", new Clock(25, 160).toString());
59 62
     }
60 63
 
61
-    @Ignore
64
+    @Ignore("Remove to run test")
62 65
     @Test
63 66
     public void hourAndMinutesRollOverContinuously() {
64 67
         assertEquals("11:01", new Clock(201, 3001).toString());
65 68
     }
66 69
 
67
-    @Ignore
70
+    @Ignore("Remove to run test")
68 71
     @Test
69 72
     public void hourAndMinutesRollOverToExactlyMidnight() {
70 73
         assertEquals("00:00", new Clock(72, 8640).toString());
71 74
     }
72 75
 
73
-    @Ignore
76
+    @Ignore("Remove to run test")
74 77
     @Test
75 78
     public void negativeHour() {
76 79
         assertEquals("23:15", new Clock(-1, 15).toString());
77 80
     }
78 81
 
79
-    @Ignore
82
+    @Ignore("Remove to run test")
80 83
     @Test
81 84
     public void negativeHourRollsOver() {
82 85
         assertEquals("23:00", new Clock(-25, 0).toString());
83 86
     }
84 87
 
85
-    @Ignore
88
+    @Ignore("Remove to run test")
86 89
     @Test
87 90
     public void negativeHourRollsOverContinuously() {
88 91
         assertEquals("05:00", new Clock(-91, 0).toString());
89 92
     }
90 93
 
91
-    @Ignore
94
+    @Ignore("Remove to run test")
92 95
     @Test
93 96
     public void negativeMinutes() {
94 97
         assertEquals("00:20", new Clock(1, -40).toString());
95 98
     }
96 99
 
97
-    @Ignore
100
+    @Ignore("Remove to run test")
98 101
     @Test
99 102
     public void negativeMinutesRollOver() {
100 103
         assertEquals("22:20", new Clock(1, -160).toString());
101 104
     }
102 105
 
103
-    @Ignore
106
+    @Ignore("Remove to run test")
104 107
     @Test
105 108
     public void negativeMinutesRollOverContinuously() {
106 109
         assertEquals("16:40", new Clock(1, -4820).toString());
107 110
     }
108 111
 
109
-    @Ignore
112
+    @Ignore("Remove to run test")
110 113
     @Test
111 114
     public void negativeHourAndMinutesBothRollOver() {
112 115
         assertEquals("20:20", new Clock(-25, -160).toString());
113 116
     }
114 117
 
115
-    @Ignore
118
+    @Ignore("Remove to run test")
116 119
     @Test
117 120
     public void negativeHourAndMinutesBothRollOverContinuously() {
118 121
         assertEquals("22:10", new Clock(-121, -5810).toString());

+ 36
- 32
exercises/clock/src/test/java/ClockEqualTest.java Dosyayı Görüntüle

@@ -1,98 +1,102 @@
1 1
 import org.junit.Ignore;
2 2
 import org.junit.Test;
3 3
 
4
-import static org.junit.Assert.assertFalse;
5
-import static org.junit.Assert.assertTrue;
4
+import static org.junit.Assert.assertNotEquals;
5
+import static org.junit.Assert.assertEquals;
6 6
 
7
+/*
8
+ * version: 1.0.1
9
+ */
7 10
 public class ClockEqualTest {
8 11
 
9
-    @Ignore
12
+    @Ignore("Remove to run test")
10 13
     @Test
11 14
     public void clocksWithSameTimeAreEqual() {
12
-        assertTrue(new Clock(15, 37).equals(new Clock(15, 37)));
15
+        assertEquals(new Clock(15, 37), new Clock(15, 37));
13 16
     }
14 17
 
15
-    @Ignore
18
+    @Ignore("Remove to run test")
16 19
     @Test
17 20
     public void clocksAMinuteApartAreNotEqual() {
18
-        assertFalse(new Clock(15, 36).equals(new Clock(15, 37)));
21
+        assertNotEquals(new Clock(15, 36), new Clock(15, 37));
19 22
     }
20 23
 
21
-    @Ignore
24
+    @Ignore("Remove to run test")
22 25
     @Test
23 26
     public void clocksAnHourApartAreNotEqual() {
24
-        assertFalse(new Clock(14, 37).equals(new Clock(15, 37)));
27
+        assertNotEquals(new Clock(14, 37), new Clock(15, 37));
25 28
     }
26 29
 
27
-    @Ignore
30
+    @Ignore("Remove to run test")
28 31
     @Test
29 32
     public void clocksWithHourOverflow() {
30
-        assertTrue(new Clock(10, 37).equals(new Clock(34, 37)));
33
+        assertEquals(new Clock(10, 37), new Clock(34, 37));
31 34
     }
32 35
 
33
-    @Ignore
36
+    @Ignore("Remove to run test")
34 37
     @Test
35 38
     public void clocksWithHourOverflowBySeveralDays() {
36
-        assertTrue(new Clock(3, 11).equals(new Clock(99, 11)));
39
+        assertEquals(new Clock(3, 11), new Clock(99, 11));
37 40
     }
38 41
 
39
-    @Ignore
42
+    @Ignore("Remove to run test")
40 43
     @Test
41 44
     public void clocksWithNegateHour() {
42
-        assertTrue(new Clock(22, 40).equals(new Clock(-2, 40)));
45
+        assertEquals(new Clock(22, 40), new Clock(-2, 40));
43 46
     }
44 47
 
45
-    @Ignore
48
+    @Ignore("Remove to run test")
46 49
     @Test
47 50
     public void clocksWithNegativeHourThatWraps() {
48
-        assertTrue(new Clock(17, 3).equals(new Clock(-31, 3)));
51
+        assertEquals(new Clock(17, 3), new Clock(-31, 3));
49 52
     }
50 53
 
51
-    @Ignore
54
+    @Ignore("Remove to run test")
52 55
     @Test
53 56
     public void clocksWithNegativeHourThatWrapsMultipleTimes() {
54
-        assertTrue(new Clock(13, 49).equals(new Clock(-83, 49)));
57
+        assertEquals(new Clock(13, 49), new Clock(-83, 49));
55 58
     }
56 59
 
57
-    @Ignore
60
+    @Ignore("Remove to run test")
58 61
     @Test
59 62
     public void clocksWithMinuteOverflow() {
60
-        assertTrue(new Clock(0, 1).equals(new Clock(0, 1441)));
63
+        assertEquals(new Clock(0, 1), new Clock(0, 1441));
61 64
     }
62 65
 
63
-    @Ignore
66
+    @Ignore("Remove to run test")
64 67
     @Test
65 68
     public void clocksWithMinuteOverflowBySeveralDays() {
66
-        assertTrue(new Clock(2, 2).equals(new Clock(2, 4322)));
69
+        assertEquals(new Clock(2, 2), new Clock(2, 4322));
67 70
     }
68 71
 
69
-    @Ignore
72
+    @Ignore("Remove to run test")
70 73
     @Test
71 74
     public void clocksWithNegativeMinutes() {
72
-        assertTrue(new Clock(2, 40).equals(new Clock(3, -20)));
75
+        assertEquals(new Clock(2, 40), new Clock(3, -20));
73 76
     }
74 77
 
75
-    @Ignore
78
+    @Ignore("Remove to run test")
76 79
     @Test
77 80
     public void clocksWithNegativeMinutesThatWraps() {
78
-        assertTrue(new Clock(4, 10).equals(new Clock(5, -1490)));
81
+        assertEquals(new Clock(4, 10), new Clock(5, -1490));
79 82
     }
80 83
 
81
-    @Ignore
84
+    @Ignore("Remove to run test")
82 85
     @Test
83 86
     public void clocksWithNegativeMinutesThatWrapsMultipleTimes() {
84
-        assertTrue(new Clock(6, 15).equals(new Clock(6, -4305)));
87
+        assertEquals(new Clock(6, 15), new Clock(6, -4305));
85 88
     }
86 89
 
87
-    @Ignore
90
+    @Ignore("Remove to run test")
88 91
     @Test
89 92
     public void clocksWithNegativeHoursAndMinutes() {
90
-        assertTrue(new Clock(7, 32).equals(new Clock(-12, -268)));
93
+        assertEquals(new Clock(7, 32), new Clock(-12, -268));
91 94
     }
92 95
 
93
-    @Ignore
96
+    @Ignore("Remove to run test")
94 97
     @Test
95 98
     public void clocksWithNegativeHoursAndMinutesThatWrap() {
96
-        assertTrue(new Clock(18, 7).equals(new Clock(-54, -11513)));
99
+        assertEquals(new Clock(18, 7), new Clock(-54, -11513));
97 100
     }
101
+
98 102
 }

+ 18
- 0
exercises/collatz-conjecture/build.gradle Dosyayı Görüntüle

@@ -0,0 +1,18 @@
1
+apply plugin: "java"
2
+apply plugin: "eclipse"
3
+apply plugin: "idea"
4
+
5
+repositories {
6
+    mavenCentral()
7
+}
8
+
9
+dependencies {
10
+    testCompile "junit:junit:4.12"
11
+}
12
+
13
+test {
14
+    testLogging {
15
+        exceptionFormat = 'full'
16
+        events = ["passed", "failed", "skipped"]
17
+    }
18
+}

+ 19
- 0
exercises/collatz-conjecture/src/example/java/CollatzCalculator.java Dosyayı Görüntüle

@@ -0,0 +1,19 @@
1
+class CollatzCalculator {
2
+
3
+    int computeStepCount(final int start) {
4
+        if (start <= 0) throw new IllegalArgumentException("Only natural numbers are allowed");
5
+
6
+        if (start == 1) return 0;
7
+
8
+        final int next;
9
+
10
+        if (start % 2 == 0) {
11
+            next = start / 2;
12
+        } else {
13
+            next = 3 * start + 1;
14
+        }
15
+
16
+        return 1 + computeStepCount(next);
17
+    }
18
+
19
+}

+ 7
- 0
exercises/collatz-conjecture/src/main/java/CollatzCalculator.java Dosyayı Görüntüle

@@ -0,0 +1,7 @@
1
+class CollatzCalculator {
2
+
3
+    int computeStepCount(int start) {
4
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
5
+    }
6
+
7
+}

+ 65
- 0
exercises/collatz-conjecture/src/test/java/CollatzCalculatorTest.java Dosyayı Görüntüle

@@ -0,0 +1,65 @@
1
+import org.junit.Before;
2
+import org.junit.Ignore;
3
+import org.junit.Rule;
4
+import org.junit.Test;
5
+import org.junit.rules.ExpectedException;
6
+
7
+import static org.junit.Assert.assertEquals;
8
+
9
+/*
10
+ * version: 1.1.0
11
+ */
12
+public class CollatzCalculatorTest {
13
+
14
+    @Rule
15
+    public ExpectedException expectedException = ExpectedException.none();
16
+
17
+    private CollatzCalculator collatzCalculator;
18
+
19
+    @Before
20
+    public void setUp() {
21
+        collatzCalculator = new CollatzCalculator();
22
+    }
23
+
24
+    @Test
25
+    public void testZeroStepsRequiredWhenStartingFrom1() {
26
+        assertEquals(0, collatzCalculator.computeStepCount(1));
27
+    }
28
+
29
+    @Ignore("Remove to run test")
30
+    @Test
31
+    public void testCorrectNumberOfStepsWhenAllStepsAreDivisions() {
32
+        assertEquals(4, collatzCalculator.computeStepCount(16));
33
+    }
34
+
35
+    @Ignore("Remove to run test")
36
+    @Test
37
+    public void testCorrectNumberOfStepsWhenBothStepTypesAreNeeded() {
38
+        assertEquals(9, collatzCalculator.computeStepCount(12));
39
+    }
40
+
41
+    @Ignore("Remove to run test")
42
+    @Test
43
+    public void testAVeryLargeInput() {
44
+        assertEquals(152, collatzCalculator.computeStepCount(1000000));
45
+    }
46
+
47
+    @Ignore("Remove to run test")
48
+    @Test
49
+    public void testZeroIsConsideredInvalidInput() {
50
+        expectedException.expect(IllegalArgumentException.class);
51
+        expectedException.expectMessage("Only natural numbers are allowed");
52
+
53
+        collatzCalculator.computeStepCount(0);
54
+    }
55
+
56
+    @Ignore("Remove to run test")
57
+    @Test
58
+    public void testNegativeIntegerIsConsideredInvalidInput() {
59
+        expectedException.expect(IllegalArgumentException.class);
60
+        expectedException.expectMessage("Only natural numbers are allowed");
61
+
62
+        collatzCalculator.computeStepCount(-15);
63
+    }
64
+
65
+}

+ 1
- 0
exercises/crypto-square/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 14
- 14
exercises/crypto-square/src/test/java/CryptoSquareTest.java Dosyayı Görüntüle

@@ -17,7 +17,7 @@ public class CryptoSquareTest {
17 17
         assertEquals(expectedOutput, crypto.getNormalizedPlaintext());
18 18
     }
19 19
 
20
-    @Ignore
20
+    @Ignore("Remove to run test")
21 21
     @Test
22 22
     public void lettersAreLowerCasedDuringNormalization() {
23 23
         Crypto crypto = new Crypto("WHOA HEY!");
@@ -26,7 +26,7 @@ public class CryptoSquareTest {
26 26
         assertEquals(expectedOutput, crypto.getNormalizedPlaintext());
27 27
     }
28 28
 
29
-    @Ignore
29
+    @Ignore("Remove to run test")
30 30
     @Test
31 31
     public void numbersAreKeptDuringNormalization() {
32 32
         Crypto crypto = new Crypto("1, 2, 3, GO!");
@@ -35,7 +35,7 @@ public class CryptoSquareTest {
35 35
         assertEquals(expectedOutput, crypto.getNormalizedPlaintext());
36 36
     }
37 37
 
38
-    @Ignore
38
+    @Ignore("Remove to run test")
39 39
     @Test
40 40
     public void smallestSquareSizeIs2() {
41 41
         Crypto crypto = new Crypto("1234");
@@ -44,7 +44,7 @@ public class CryptoSquareTest {
44 44
         assertEquals(expectedOutput, crypto.getSquareSize());
45 45
     }
46 46
 
47
-    @Ignore
47
+    @Ignore("Remove to run test")
48 48
     @Test
49 49
     public void sizeOfTextWhoseLengthIsPerfectSquareIsItsSquareRoot() {
50 50
         Crypto crypto = new Crypto("123456789");
@@ -53,7 +53,7 @@ public class CryptoSquareTest {
53 53
         assertEquals(expectedOutput, crypto.getSquareSize());
54 54
     }
55 55
 
56
-    @Ignore
56
+    @Ignore("Remove to run test")
57 57
     @Test
58 58
     public void sizeOfTextWhoseLengthIsNoPerfectSquareIsNextBiggestSquareRoot() {
59 59
         Crypto crypto = new Crypto("123456789abc");
@@ -62,7 +62,7 @@ public class CryptoSquareTest {
62 62
         assertEquals(expectedOutput, crypto.getSquareSize());
63 63
     }
64 64
 
65
-    @Ignore
65
+    @Ignore("Remove to run test")
66 66
     @Test
67 67
     public void sizeIsDeterminedByNormalizedText() {
68 68
         Crypto crypto = new Crypto("Oh hey, this is nuts!");
@@ -71,7 +71,7 @@ public class CryptoSquareTest {
71 71
         assertEquals(expectedOutput, crypto.getSquareSize());
72 72
     }
73 73
 
74
-    @Ignore
74
+    @Ignore("Remove to run test")
75 75
     @Test
76 76
     public void segmentsAreSplitBySquareSize() {
77 77
         Crypto crypto = new Crypto("Never vex thine heart with idle woes");
@@ -80,7 +80,7 @@ public class CryptoSquareTest {
80 80
         assertEquals(expectedOutput, crypto.getPlaintextSegments());
81 81
     }
82 82
 
83
-    @Ignore
83
+    @Ignore("Remove to run test")
84 84
     @Test
85 85
     public void segmentsAreSplitBySquareSizeUntilTextRunsOut() {
86 86
         Crypto crypto = new Crypto("ZOMG! ZOMBIES!!!");
@@ -89,7 +89,7 @@ public class CryptoSquareTest {
89 89
         assertEquals(expectedOutput, crypto.getPlaintextSegments());
90 90
     }
91 91
 
92
-    @Ignore
92
+    @Ignore("Remove to run test")
93 93
     @Test
94 94
     public void cipherTextCombinesTextByColumn() {
95 95
         Crypto crypto = new Crypto("First, solve the problem. Then, write the code.");
@@ -98,7 +98,7 @@ public class CryptoSquareTest {
98 98
         assertEquals(expectedOutput, crypto.getCipherText());
99 99
     }
100 100
 
101
-    @Ignore
101
+    @Ignore("Remove to run test")
102 102
     @Test
103 103
     public void cipherTextSkipsCellsWithNoText() {
104 104
         Crypto crypto = new Crypto("Time is an illusion. Lunchtime doubly so.");
@@ -107,7 +107,7 @@ public class CryptoSquareTest {
107 107
         assertEquals(expectedOutput, crypto.getCipherText());
108 108
     }
109 109
 
110
-    @Ignore
110
+    @Ignore("Remove to run test")
111 111
     @Test
112 112
     public void normalizedCipherTextIsSplitByHeightOfSquare() {
113 113
         Crypto crypto = new Crypto("Vampires are people too!");
@@ -116,7 +116,7 @@ public class CryptoSquareTest {
116 116
         assertEquals(expectedOutput, crypto.getNormalizedCipherText());
117 117
     }
118 118
 
119
-    @Ignore
119
+    @Ignore("Remove to run test")
120 120
     @Test
121 121
     public void normalizedCipherNotExactlyDivisibleBy5SpillsIntoSmallerSegment() {
122 122
         Crypto crypto = new Crypto("Madness, and then illumination.");
@@ -125,7 +125,7 @@ public class CryptoSquareTest {
125 125
         assertEquals(expectedOutput, crypto.getNormalizedCipherText());
126 126
     }
127 127
 
128
-    @Ignore
128
+    @Ignore("Remove to run test")
129 129
     @Test
130 130
     public void normalizedCipherIsSplitIntoSegmentsOfCorrectSize() {
131 131
         Crypto crypto = new Crypto("If man was meant to stay on the ground god would have given us roots");
@@ -134,7 +134,7 @@ public class CryptoSquareTest {
134 134
         assertEquals(expectedOutput, crypto.getNormalizedCipherText());
135 135
     }
136 136
 
137
-    @Ignore
137
+    @Ignore("Remove to run test")
138 138
     @Test
139 139
     public void normalizedCipherTextIsSplitIntoSegmentsOfCorrectSizeWithPunctuation() {
140 140
         Crypto crypto = new Crypto("Have a nice day. Feed the dog & chill out!");

+ 36
- 36
exercises/custom-set/src/test/java/CustomSetTest.java Dosyayı Görüntüle

@@ -18,7 +18,7 @@ public class CustomSetTest {
18 18
     }
19 19
 
20 20
     @Test
21
-    @Ignore
21
+    @Ignore("Remove to run test")
22 22
     public void setsWithElementsAreNotEmpty() {
23 23
         final boolean actual
24 24
                 = new CustomSet<>(Arrays.asList(1))
@@ -28,7 +28,7 @@ public class CustomSetTest {
28 28
     }
29 29
 
30 30
     @Test
31
-    @Ignore
31
+    @Ignore("Remove to run test")
32 32
     public void nothingIsContainedInAnEmptySet() {
33 33
         final boolean actual
34 34
                 = new CustomSet<>(Collections.EMPTY_LIST)
@@ -38,7 +38,7 @@ public class CustomSetTest {
38 38
     }
39 39
 
40 40
     @Test
41
-    @Ignore
41
+    @Ignore("Remove to run test")
42 42
     public void whenTheElementIsInTheSet() {
43 43
         final boolean actual
44 44
                 = new CustomSet<>(Arrays.asList(1, 2, 3))
@@ -48,7 +48,7 @@ public class CustomSetTest {
48 48
     }
49 49
 
50 50
     @Test
51
-    @Ignore
51
+    @Ignore("Remove to run test")
52 52
     public void whenTheElementIsNotInTheSet() {
53 53
         final boolean actual
54 54
                 = new CustomSet<>(Arrays.asList(1, 2, 3))
@@ -58,7 +58,7 @@ public class CustomSetTest {
58 58
     }
59 59
 
60 60
     @Test
61
-    @Ignore
61
+    @Ignore("Remove to run test")
62 62
     public void emptySetIsASubsetOfAnotherEmptySet() {
63 63
         final boolean actual
64 64
                 = new CustomSet<>(Collections.EMPTY_LIST)
@@ -70,7 +70,7 @@ public class CustomSetTest {
70 70
     }
71 71
 
72 72
     @Test
73
-    @Ignore
73
+    @Ignore("Remove to run test")
74 74
     public void emptySetIsASubsetOfNonEemptySet() {
75 75
         final boolean actual
76 76
                 = new CustomSet<>(Arrays.asList(1))
@@ -82,7 +82,7 @@ public class CustomSetTest {
82 82
     }
83 83
 
84 84
     @Test
85
-    @Ignore
85
+    @Ignore("Remove to run test")
86 86
     public void nonEmptySetIsNotASubsetOfEmptySet() {
87 87
         final boolean actual
88 88
                 = new CustomSet<>(Collections.EMPTY_LIST)
@@ -94,7 +94,7 @@ public class CustomSetTest {
94 94
     }
95 95
 
96 96
     @Test
97
-    @Ignore
97
+    @Ignore("Remove to run test")
98 98
     public void setIsASubsetOfSetWithExactSameElements() {
99 99
         final boolean actual
100 100
                 = new CustomSet<>(Arrays.asList(1, 2, 3))
@@ -106,7 +106,7 @@ public class CustomSetTest {
106 106
     }
107 107
 
108 108
     @Test
109
-    @Ignore
109
+    @Ignore("Remove to run test")
110 110
     public void setIsASubsetOfLargerSetWithSameElements() {
111 111
         final boolean actual
112 112
                 = new CustomSet<>(Arrays.asList(4, 1, 2, 3))
@@ -118,7 +118,7 @@ public class CustomSetTest {
118 118
     }
119 119
 
120 120
     @Test
121
-    @Ignore
121
+    @Ignore("Remove to run test")
122 122
     public void setIsNotASubsetOfSetThatDoesNotContainItsElements() {
123 123
         final boolean actual
124 124
                 = new CustomSet<>(Arrays.asList(4, 1, 3))
@@ -130,7 +130,7 @@ public class CustomSetTest {
130 130
     }
131 131
 
132 132
     @Test
133
-    @Ignore
133
+    @Ignore("Remove to run test")
134 134
     public void theEmptySetIsDisjointWithItself() {
135 135
         final boolean actual
136 136
                 = new CustomSet<>(Collections.EMPTY_LIST)
@@ -142,7 +142,7 @@ public class CustomSetTest {
142 142
     }
143 143
 
144 144
     @Test
145
-    @Ignore
145
+    @Ignore("Remove to run test")
146 146
     public void emptySetIsDisjointWithNonEmptySet() {
147 147
         final boolean actual
148 148
                 = new CustomSet<>(Collections.EMPTY_LIST)
@@ -154,7 +154,7 @@ public class CustomSetTest {
154 154
     }
155 155
 
156 156
     @Test
157
-    @Ignore
157
+    @Ignore("Remove to run test")
158 158
     public void nonEmptySetIsDisjointWithEmptySet() {
159 159
         final boolean actual
160 160
                 = new CustomSet<>(Arrays.asList(1))
@@ -166,7 +166,7 @@ public class CustomSetTest {
166 166
     }
167 167
 
168 168
     @Test
169
-    @Ignore
169
+    @Ignore("Remove to run test")
170 170
     public void setsAreNotDisjointIfTheyShareAnElement() {
171 171
         final boolean actual
172 172
                 = new CustomSet<>(Arrays.asList(1, 2))
@@ -178,7 +178,7 @@ public class CustomSetTest {
178 178
     }
179 179
 
180 180
     @Test
181
-    @Ignore
181
+    @Ignore("Remove to run test")
182 182
     public void setsAreDisjointIfTheyShareNoElements() {
183 183
         final boolean actual
184 184
                 = new CustomSet<>(Arrays.asList(1, 2))
@@ -190,7 +190,7 @@ public class CustomSetTest {
190 190
     }
191 191
 
192 192
     @Test
193
-    @Ignore
193
+    @Ignore("Remove to run test")
194 194
     public void emptySetsAreEqual() {
195 195
         final boolean actual
196 196
                 = new CustomSet<>(Collections.EMPTY_LIST)
@@ -202,7 +202,7 @@ public class CustomSetTest {
202 202
     }
203 203
 
204 204
     @Test
205
-    @Ignore
205
+    @Ignore("Remove to run test")
206 206
     public void emptySetIsNotEqualToNonEmptySet() {
207 207
         final boolean actual
208 208
                 = new CustomSet<>(Collections.EMPTY_LIST)
@@ -214,7 +214,7 @@ public class CustomSetTest {
214 214
     }
215 215
 
216 216
     @Test
217
-    @Ignore
217
+    @Ignore("Remove to run test")
218 218
     public void nonEmptySetIsNotEqualToEmptySet() {
219 219
         final boolean actual
220 220
                 = new CustomSet<>(Arrays.asList(1, 2, 3))
@@ -226,7 +226,7 @@ public class CustomSetTest {
226 226
     }
227 227
 
228 228
     @Test
229
-    @Ignore
229
+    @Ignore("Remove to run test")
230 230
     public void setsWithTheSameElementsAreEqual() {
231 231
         final boolean actual
232 232
                 = new CustomSet<>(Arrays.asList(1, 2))
@@ -238,7 +238,7 @@ public class CustomSetTest {
238 238
     }
239 239
 
240 240
     @Test
241
-    @Ignore
241
+    @Ignore("Remove to run test")
242 242
     public void setsWithDifferentElementsAreNotEqual() {
243 243
         final boolean actual
244 244
                 = new CustomSet<>(Arrays.asList(1, 2, 3))
@@ -250,7 +250,7 @@ public class CustomSetTest {
250 250
     }
251 251
 
252 252
     @Test
253
-    @Ignore
253
+    @Ignore("Remove to run test")
254 254
     public void addToEmptySet() {
255 255
         final int element = 3;
256 256
         final CustomSet<Integer> expected
@@ -268,7 +268,7 @@ public class CustomSetTest {
268 268
     }
269 269
 
270 270
     @Test
271
-    @Ignore
271
+    @Ignore("Remove to run test")
272 272
     public void addToNonEmptySet() {
273 273
         final int element = 3;
274 274
         final CustomSet<Integer> expected
@@ -286,7 +286,7 @@ public class CustomSetTest {
286 286
     }
287 287
 
288 288
     @Test
289
-    @Ignore
289
+    @Ignore("Remove to run test")
290 290
     public void addingAnExistingElementDoesNotChangeTheSet() {
291 291
         final int element = 3;
292 292
         final CustomSet<Integer> expected
@@ -303,7 +303,7 @@ public class CustomSetTest {
303 303
     }
304 304
 
305 305
     @Test
306
-    @Ignore
306
+    @Ignore("Remove to run test")
307 307
     public void intersectionOfTwoEmptySetsIsAnEmptySet() {
308 308
         final CustomSet<Integer> actual
309 309
                 = new CustomSet<>(Collections.EMPTY_LIST)
@@ -316,7 +316,7 @@ public class CustomSetTest {
316 316
     }
317 317
 
318 318
     @Test
319
-    @Ignore
319
+    @Ignore("Remove to run test")
320 320
     public void intersectionOfAnEmptySetAndNonEmptySetIsAnEmptySet() {
321 321
         final CustomSet<Integer> actual
322 322
                 = new CustomSet<>(Collections.EMPTY_LIST)
@@ -329,7 +329,7 @@ public class CustomSetTest {
329 329
     }
330 330
 
331 331
     @Test
332
-    @Ignore
332
+    @Ignore("Remove to run test")
333 333
     public void intersectionOfANonEmptySetAndAnEmptySetIsAnEmptySet() {
334 334
         final CustomSet<Integer> actual
335 335
                 = new CustomSet<>(Arrays.asList(1, 2, 3, 4))
@@ -343,7 +343,7 @@ public class CustomSetTest {
343 343
     }
344 344
 
345 345
     @Test
346
-    @Ignore
346
+    @Ignore("Remove to run test")
347 347
     public void intersectionOfTwoSetsWithNoSharedElementsIsAnEmptySet() {
348 348
         final CustomSet<Integer> actual
349 349
                 = new CustomSet<>(Arrays.asList(1, 2, 3))
@@ -356,7 +356,7 @@ public class CustomSetTest {
356 356
     }
357 357
 
358 358
     @Test
359
-    @Ignore
359
+    @Ignore("Remove to run test")
360 360
     public void intersectionOfTwoSetsWithSharedElementsIsASetOfTheSharedElements() {
361 361
         final CustomSet<Integer> expected
362 362
                 = new CustomSet<>(
@@ -374,7 +374,7 @@ public class CustomSetTest {
374 374
     }
375 375
 
376 376
     @Test
377
-    @Ignore
377
+    @Ignore("Remove to run test")
378 378
     public void differenceOfTwoEmptySetsIsAnEmptySet() {
379 379
         final CustomSet<Integer> actual
380 380
                 = new CustomSet<>(Collections.EMPTY_LIST)
@@ -387,7 +387,7 @@ public class CustomSetTest {
387 387
     }
388 388
 
389 389
     @Test
390
-    @Ignore
390
+    @Ignore("Remove to run test")
391 391
     public void differenceOfAnEmptySetAndNonEmptySetIsAnEmptySet() {
392 392
         final CustomSet<Integer> actual
393 393
                 = new CustomSet<>(Collections.EMPTY_LIST)
@@ -400,7 +400,7 @@ public class CustomSetTest {
400 400
     }
401 401
 
402 402
     @Test
403
-    @Ignore
403
+    @Ignore("Remove to run test")
404 404
     public void differenceOfANonEmptySetAndAnEmptySetIsTheNonEmptySet() {
405 405
         final CustomSet<Integer> expected
406 406
                 = new CustomSet<>(
@@ -418,7 +418,7 @@ public class CustomSetTest {
418 418
     }
419 419
 
420 420
     @Test
421
-    @Ignore
421
+    @Ignore("Remove to run test")
422 422
     public void differenceOfTwoNonEmptySetsIsASetOfElementsThatAreOnlyInTheFirstSet() {
423 423
         final CustomSet<Integer> expected
424 424
                 = new CustomSet<>(
@@ -436,7 +436,7 @@ public class CustomSetTest {
436 436
     }
437 437
 
438 438
     @Test
439
-    @Ignore
439
+    @Ignore("Remove to run test")
440 440
     public void unionOfTwoEmptySetsIsAnEmptySet() {
441 441
         final CustomSet<Integer> actual
442 442
                 = new CustomSet<>(Collections.EMPTY_LIST)
@@ -449,7 +449,7 @@ public class CustomSetTest {
449 449
     }
450 450
 
451 451
     @Test
452
-    @Ignore
452
+    @Ignore("Remove to run test")
453 453
     public void unionOfAnEmptySetAndNonEmptySetIsTheNonEmptySet() {
454 454
         final CustomSet<Integer> expected
455 455
                 = new CustomSet<>(
@@ -467,7 +467,7 @@ public class CustomSetTest {
467 467
     }
468 468
 
469 469
     @Test
470
-    @Ignore
470
+    @Ignore("Remove to run test")
471 471
     public void unionOfANonEmptySetAndAnEmptySetIsTheNonEmptySet() {
472 472
         final CustomSet<Integer> expected
473 473
                 = new CustomSet<>(
@@ -485,7 +485,7 @@ public class CustomSetTest {
485 485
     }
486 486
 
487 487
     @Test
488
-    @Ignore
488
+    @Ignore("Remove to run test")
489 489
     public void unionOfTwoNonEmptySetsContainsAllUniqueElements() {
490 490
         final CustomSet<Integer> expected
491 491
                 = new CustomSet<>(

+ 1
- 0
exercises/diamond/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 4
- 4
exercises/diamond/src/example/java/DiamondPrinter.java Dosyayı Görüntüle

@@ -17,7 +17,7 @@ final class DiamondPrinter {
17 17
     List<String> printToList(final char chr) {
18 18
         final int nRows = 2 * ((int) chr - A_INT) + 1;
19 19
 
20
-        final List<String> topRows = new ArrayList<>();
20
+        final List<String> result = new ArrayList<>();
21 21
 
22 22
         // Populate the top rows.
23 23
         for (int nRow = 0; nRow < (nRows + 1) / 2; nRow++) {
@@ -27,15 +27,15 @@ final class DiamondPrinter {
27 27
             final String rightHalfOfRow = reverse(leftHalfOfRow.substring(0, leftHalfOfRow.length() - 1));
28 28
             final String fullRow        = leftHalfOfRow + rightHalfOfRow;
29 29
 
30
-            topRows.add(fullRow);
30
+            result.add(fullRow);
31 31
         }
32 32
 
33 33
         // Populate the bottom rows by 'reflecting' the top rows.
34 34
         for (int nRow = (nRows - 1) / 2 - 1; nRow >= 0; nRow--) {
35
-            topRows.add(topRows.get(nRow));
35
+            result.add(result.get(nRow));
36 36
         }
37 37
 
38
-        return topRows;
38
+        return result;
39 39
     }
40 40
 
41 41
 }

+ 1
- 1
exercises/diamond/src/main/java/DiamondPrinter.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-final class DiamondPrinter {
1
+class DiamondPrinter {
2 2
 
3 3
 
4 4
 

+ 21
- 10
exercises/diamond/src/test/java/DiamondPrinterTest.java Dosyayı Görüntüle

@@ -1,4 +1,5 @@
1 1
 import org.junit.Ignore;
2
+import org.junit.Before;
2 3
 import org.junit.Test;
3 4
 
4 5
 import java.util.List;
@@ -8,27 +9,37 @@ import static java.util.Collections.singletonList;
8 9
 import static org.hamcrest.CoreMatchers.is;
9 10
 import static org.junit.Assert.assertThat;
10 11
 
11
-public final class DiamondPrinterTest {
12
+/*
13
+ * version: 1.0.0
14
+ */
15
+public class DiamondPrinterTest {
16
+
17
+    private DiamondPrinter diamondPrinter;
18
+
19
+    @Before
20
+    public void setUp() {
21
+        diamondPrinter = new DiamondPrinter();
22
+    }
12 23
 
13 24
     @Test
14 25
     public void testOneByOneDiamond() {
15
-        List<String> output = new DiamondPrinter().printToList('A');
26
+        List<String> output = diamondPrinter.printToList('A');
16 27
         assertThat(output, is(singletonList("A")));
17 28
     }
18 29
 
19
-    @Ignore
30
+    @Ignore("Remove to run test")
20 31
     @Test
21 32
     public void testTwoByTwoDiamond() {
22
-        List<String> output = new DiamondPrinter().printToList('B');
33
+        List<String> output = diamondPrinter.printToList('B');
23 34
         assertThat(output, is(asList(" A ",
24 35
                                      "B B",
25 36
                                      " A ")));
26 37
     }
27 38
 
28
-    @Ignore
39
+    @Ignore("Remove to run test")
29 40
     @Test
30 41
     public void testThreeByThreeDiamond() {
31
-        List<String> output = new DiamondPrinter().printToList('C');
42
+        List<String> output = diamondPrinter.printToList('C');
32 43
         assertThat(output, is(asList("  A  ",
33 44
                                      " B B ",
34 45
                                      "C   C",
@@ -36,10 +47,10 @@ public final class DiamondPrinterTest {
36 47
                                      "  A  ")));
37 48
     }
38 49
 
39
-    @Ignore
50
+    @Ignore("Remove to run test")
40 51
     @Test
41 52
     public void testFiveByFiveDiamond() {
42
-        List<String> output = new DiamondPrinter().printToList('E');
53
+        List<String> output = diamondPrinter.printToList('E');
43 54
         assertThat(output, is(asList("    A    ",
44 55
                                      "   B B   ",
45 56
                                      "  C   C  ",
@@ -51,10 +62,10 @@ public final class DiamondPrinterTest {
51 62
                                      "    A    ")));
52 63
     }
53 64
 
54
-    @Ignore
65
+    @Ignore("Remove to run test")
55 66
     @Test
56 67
     public void testFullDiamond() {
57
-        List<String> output = new DiamondPrinter().printToList('Z');
68
+        List<String> output = diamondPrinter.printToList('Z');
58 69
         assertThat(output, is(asList("                         A                         ",
59 70
                                      "                        B B                        ",
60 71
                                      "                       C   C                       ",

+ 1
- 0
exercises/difference-of-squares/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

exercises/difference-of-squares/src/example/java/Difference.java → exercises/difference-of-squares/src/example/java/DifferenceOfSquaresCalculator.java Dosyayı Görüntüle

@@ -1,19 +1,19 @@
1 1
 import java.util.stream.IntStream;
2 2
 
3
-public final class Difference {
3
+final class DifferenceOfSquaresCalculator {
4 4
 
5
-    public static int computeSquareOfSumTo(final int input) {
5
+    int computeSquareOfSumTo(final int input) {
6 6
         final int sum = input * (input + 1) / 2;
7 7
         return (int) Math.pow(sum, 2);
8 8
     }
9 9
 
10
-    public static int computeSumOfSquaresTo(final int input) {
10
+    int computeSumOfSquaresTo(final int input) {
11 11
         return IntStream.rangeClosed(1, input)
12 12
                 .map(i -> (int) Math.pow(i, 2))
13 13
                 .sum();
14 14
     }
15 15
 
16
-    public static int betweenSquareOfSumAndSumOfSquaresTo(final int input) {
16
+    int computeDifferenceOfSquares(final int input) {
17 17
         return computeSquareOfSumTo(input) - computeSumOfSquaresTo(input);
18 18
     }
19 19
 

exercises/allergies/src/main/java/.keep → exercises/difference-of-squares/src/main/java/.keep Dosyayı Görüntüle


+ 0
- 5
exercises/difference-of-squares/src/main/java/Difference.java Dosyayı Görüntüle

@@ -1,5 +0,0 @@
1
-public final class Difference {
2
-    
3
-
4
-
5
-}

+ 90
- 0
exercises/difference-of-squares/src/test/java/DifferenceOfSquaresCalculatorTest.java Dosyayı Görüntüle

@@ -0,0 +1,90 @@
1
+import org.junit.Before;
2
+import org.junit.Ignore;
3
+import org.junit.Test;
4
+
5
+import static org.junit.Assert.assertEquals;
6
+
7
+/*
8
+ * version: 1.1.0
9
+ */
10
+public class DifferenceOfSquaresCalculatorTest {
11
+
12
+    private DifferenceOfSquaresCalculator calculator;
13
+
14
+    @Before
15
+    public void setUp() {
16
+        calculator = new DifferenceOfSquaresCalculator();
17
+    }
18
+
19
+    @Test
20
+    public void testSquareOfSum1() {
21
+        final int expected = 1;
22
+        final int actual = calculator.computeSquareOfSumTo(1);
23
+        assertEquals(expected, actual);
24
+    }
25
+
26
+    @Ignore("Remove to run test")
27
+    @Test
28
+    public void testSquareOfSum5() {
29
+        final int expected = 225;
30
+        final int actual = calculator.computeSquareOfSumTo(5);
31
+        assertEquals(expected, actual);
32
+    }
33
+
34
+    @Ignore("Remove to run test")
35
+    @Test
36
+    public void testSquareOfSum100() {
37
+        final int expected = 25502500;
38
+        final int actual = calculator.computeSquareOfSumTo(100);
39
+        assertEquals(expected, actual);
40
+    }
41
+
42
+    @Ignore("Remove to run test")
43
+    @Test
44
+    public void testSumOfSquares1() {
45
+        final int expected = 1;
46
+        final int actual = calculator.computeSumOfSquaresTo(1);
47
+        assertEquals(expected, actual);
48
+    }
49
+
50
+    @Ignore("Remove to run test")
51
+    @Test
52
+    public void testSumOfSquares5() {
53
+        final int expected = 55;
54
+        final int actual = calculator.computeSumOfSquaresTo(5);
55
+        assertEquals(expected, actual);
56
+    }
57
+
58
+    @Ignore("Remove to run test")
59
+    @Test
60
+    public void testSumOfSquares100() {
61
+        final int expected = 338350;
62
+        final int actual = calculator.computeSumOfSquaresTo(100);
63
+        assertEquals(expected, actual);
64
+    }
65
+
66
+    @Ignore("Remove to run test")
67
+    @Test
68
+    public void testDifferenceOfSquares1() {
69
+        final int expected = 0;
70
+        final int actual = calculator.computeDifferenceOfSquares(1);
71
+        assertEquals(expected, actual);
72
+    }
73
+
74
+    @Ignore("Remove to run test")
75
+    @Test
76
+    public void testDifferenceOfSquares5() {
77
+        final int expected = 170;
78
+        final int actual = calculator.computeDifferenceOfSquares(5);
79
+        assertEquals(expected, actual);
80
+    }
81
+
82
+    @Ignore("Remove to run test")
83
+    @Test
84
+    public void testDifferenceOfSquares100() {
85
+        final int expected = 25164150;
86
+        final int actual = calculator.computeDifferenceOfSquares(100);
87
+        assertEquals(expected, actual);
88
+    }
89
+
90
+}

+ 0
- 87
exercises/difference-of-squares/src/test/java/DifferenceTest.java Dosyayı Görüntüle

@@ -1,87 +0,0 @@
1
-import org.junit.Ignore;
2
-import org.junit.Test;
3
-
4
-import static org.junit.Assert.assertEquals;
5
-
6
-public final class DifferenceTest {
7
-
8
-    @Test
9
-    public void testSquareOfSum5() {
10
-        final int expected = 225;
11
-        final int actual = Difference.computeSquareOfSumTo(5);
12
-        assertEquals(expected, actual);
13
-    }
14
-
15
-    @Ignore
16
-    @Test
17
-    public void testSquareOfSum10() {
18
-        final int expected = 3025;
19
-        final int actual = Difference.computeSquareOfSumTo(10);
20
-        assertEquals(expected, actual);
21
-    }
22
-
23
-    @Ignore
24
-    @Test
25
-    public void testSquareOfSum100() {
26
-        final int expected = 25502500;
27
-        final int actual = Difference.computeSquareOfSumTo(100);
28
-        assertEquals(expected, actual);
29
-    }
30
-
31
-    @Ignore
32
-    @Test
33
-    public void testSumOfSquares5() {
34
-        final int expected = 55;
35
-        final int actual = Difference.computeSumOfSquaresTo(5);
36
-        assertEquals(expected, actual);
37
-    }
38
-
39
-    @Ignore
40
-    @Test
41
-    public void testSumOfSquares10() {
42
-        final int expected = 385;
43
-        final int actual = Difference.computeSumOfSquaresTo(10);
44
-        assertEquals(expected, actual);
45
-    }
46
-
47
-    @Ignore
48
-    @Test
49
-    public void testSumOfSquares100() {
50
-        final int expected = 338350;
51
-        final int actual = Difference.computeSumOfSquaresTo(100);
52
-        assertEquals(expected, actual);
53
-    }
54
-
55
-    @Ignore
56
-    @Test
57
-    public void testDifferenceOfSquares0() {
58
-        final int expected = 0;
59
-        final int actual = Difference.betweenSquareOfSumAndSumOfSquaresTo(0);
60
-        assertEquals(expected, actual);
61
-    }
62
-
63
-    @Ignore
64
-    @Test
65
-    public void testDifferenceOfSquares5() {
66
-        final int expected = 170;
67
-        final int actual = Difference.betweenSquareOfSumAndSumOfSquaresTo(5);
68
-        assertEquals(expected, actual);
69
-    }
70
-
71
-    @Ignore
72
-    @Test
73
-    public void testDifferenceOfSquares10() {
74
-        final int expected = 2640;
75
-        final int actual = Difference.betweenSquareOfSumAndSumOfSquaresTo(10);
76
-        assertEquals(expected, actual);
77
-    }
78
-
79
-    @Ignore
80
-    @Test
81
-    public void testDifferenceOfSquares100() {
82
-        final int expected = 25164150;
83
-        final int actual = Difference.betweenSquareOfSumAndSumOfSquaresTo(100);
84
-        assertEquals(expected, actual);
85
-    }
86
-
87
-}

+ 1
- 0
exercises/etl/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 3
- 3
exercises/etl/src/test/java/EtlTest.java Dosyayı Görüntüle

@@ -28,7 +28,7 @@ public class EtlTest {
28 28
         assertEquals(expected, etl.transform(old));
29 29
     }
30 30
 
31
-    @Ignore
31
+    @Ignore("Remove to run test")
32 32
     @Test
33 33
     public void testTransformMoreValues() {
34 34
         Map<Integer, List<String>> old = new HashMap<Integer, List<String>>() {
@@ -52,7 +52,7 @@ public class EtlTest {
52 52
         assertEquals(expected, etl.transform(old));
53 53
     }
54 54
 
55
-    @Ignore
55
+    @Ignore("Remove to run test")
56 56
     @Test
57 57
     public void testMoreKeys() {
58 58
         Map<Integer, List<String>> old = new HashMap<Integer, List<String>>() {
@@ -76,7 +76,7 @@ public class EtlTest {
76 76
         assertEquals(expected, etl.transform(old));
77 77
     }
78 78
 
79
-    @Ignore
79
+    @Ignore("Remove to run test")
80 80
     @Test
81 81
     public void testFullDataset() {
82 82
         Map<Integer, List<String>> old = new HashMap<Integer, List<String>>() {

+ 1
- 0
exercises/flatten-array/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 1
- 1
exercises/flatten-array/src/main/java/Flattener.java Dosyayı Görüntüle

@@ -1,4 +1,4 @@
1
-final class Flattener {
1
+class Flattener {
2 2
 
3 3
 
4 4
 

+ 20
- 5
exercises/flatten-array/src/test/java/FlattenerTest.java Dosyayı Görüntüle

@@ -7,7 +7,10 @@ import static java.util.Collections.emptyList;
7 7
 import static java.util.Collections.singletonList;
8 8
 import static org.junit.Assert.assertEquals;
9 9
 
10
-public final class FlattenerTest {
10
+/*
11
+ * version: 1.1.0
12
+ */
13
+public class FlattenerTest {
11 14
 
12 15
     private Flattener flattener;
13 16
 
@@ -17,6 +20,18 @@ public final class FlattenerTest {
17 20
     }
18 21
 
19 22
     @Test
23
+    public void testFlatListIsPreserved() {
24
+        assertEquals(
25
+          asList(0, '1', "two"),
26
+            flattener.flatten(
27
+              asList(
28
+                0,
29
+                '1',
30
+                "two")));
31
+    }
32
+
33
+    @Ignore("Remove to run test")
34
+    @Test
20 35
     public void testASingleLevelOfNestingWithNoNulls() {
21 36
         assertEquals(
22 37
           asList(1, '2', 3, 4, 5, "six", "7", 8),
@@ -33,7 +48,7 @@ public final class FlattenerTest {
33 48
               8)));
34 49
     }
35 50
 
36
-    @Ignore
51
+    @Ignore("Remove to run test")
37 52
     @Test
38 53
     public void testFiveLevelsOfNestingWithNoNulls() {
39 54
         assertEquals(
@@ -56,7 +71,7 @@ public final class FlattenerTest {
56 71
               "-2")));
57 72
     }
58 73
 
59
-    @Ignore
74
+    @Ignore("Remove to run test")
60 75
     @Test
61 76
     public void testSixLevelsOfNestingWithNoNulls() {
62 77
         assertEquals(
@@ -79,7 +94,7 @@ public final class FlattenerTest {
79 94
               "8")));
80 95
     }
81 96
 
82
-    @Ignore
97
+    @Ignore("Remove to run test")
83 98
     @Test
84 99
     public void testSixLevelsOfNestingWithNulls() {
85 100
         assertEquals(
@@ -103,7 +118,7 @@ public final class FlattenerTest {
103 118
               "negative two")));
104 119
     }
105 120
 
106
-    @Ignore
121
+    @Ignore("Remove to run test")
107 122
     @Test
108 123
     public void testNestedListsFullOfNullsOnly() {
109 124
         assertEquals(

+ 1
- 0
exercises/gigasecond/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 7
- 6
exercises/gigasecond/src/example/java/Gigasecond.java Dosyayı Görüntüle

@@ -1,19 +1,20 @@
1 1
 import java.time.LocalDateTime;
2 2
 import java.time.LocalDate;
3 3
 
4
-public class Gigasecond {
4
+class Gigasecond {
5 5
 
6 6
     private LocalDateTime birthDateTime;
7 7
 
8
-    public Gigasecond(LocalDateTime birthDateTime) {
9
-        this.birthDateTime = birthDateTime;
8
+    Gigasecond(LocalDate birthDate) {
9
+        this.birthDateTime = birthDate.atTime(0, 0);
10 10
     }
11 11
 
12
-    public Gigasecond(LocalDate birthDate) {
13
-        this.birthDateTime = birthDate.atTime(0, 0);
12
+    Gigasecond(LocalDateTime birthDateTime) {
13
+        this.birthDateTime = birthDateTime;
14 14
     }
15 15
 
16
-    public LocalDateTime getDate() {
16
+    LocalDateTime getDate() {
17 17
         return birthDateTime.plusSeconds(1000000000);
18 18
     }
19
+
19 20
 }

+ 18
- 0
exercises/gigasecond/src/main/java/Gigasecond.java Dosyayı Görüntüle

@@ -0,0 +1,18 @@
1
+import java.time.LocalDate;
2
+import java.time.LocalDateTime;
3
+
4
+class Gigasecond {
5
+
6
+    Gigasecond(LocalDate birthDate) {
7
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
8
+    }
9
+
10
+    Gigasecond(LocalDateTime birthDateTime) {
11
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
12
+    }
13
+
14
+    LocalDateTime getDate() {
15
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
16
+    }
17
+
18
+}

+ 4
- 5
exercises/gigasecond/src/test/java/GigasecondTest.java Dosyayı Görüntüle

@@ -9,7 +9,6 @@ import static org.junit.Assert.assertEquals;
9 9
 
10 10
 public class GigasecondTest {
11 11
 
12
-
13 12
     @Test
14 13
     public void modernTime() {
15 14
         Gigasecond gigaSecond = new Gigasecond(LocalDate.of(2011, Month.APRIL, 25));
@@ -17,7 +16,7 @@ public class GigasecondTest {
17 16
         assertEquals(LocalDateTime.of(2043, Month.JANUARY, 1, 1, 46, 40), gigaSecond.getDate());
18 17
     }
19 18
 
20
-    @Ignore
19
+    @Ignore("Remove to run test")
21 20
     @Test
22 21
     public void afterEpochTime() {
23 22
         Gigasecond gigaSecond = new Gigasecond(LocalDate.of(1977, Month.JUNE, 13));
@@ -25,7 +24,7 @@ public class GigasecondTest {
25 24
         assertEquals(LocalDateTime.of(2009, Month.FEBRUARY, 19, 1, 46, 40), gigaSecond.getDate());
26 25
     }
27 26
 
28
-    @Ignore
27
+    @Ignore("Remove to run test")
29 28
     @Test
30 29
     public void beforeEpochTime() {
31 30
         Gigasecond gigaSecond = new Gigasecond(LocalDate.of(1959, Month.JULY, 19));
@@ -33,7 +32,7 @@ public class GigasecondTest {
33 32
         assertEquals(LocalDateTime.of(1991, Month.MARCH, 27, 1, 46, 40), gigaSecond.getDate());
34 33
     }
35 34
 
36
-    @Ignore
35
+    @Ignore("Remove to run test")
37 36
     @Test
38 37
     public void withFullTimeSpecified() {
39 38
         Gigasecond gigaSecond = new Gigasecond(LocalDateTime.of(2015, Month.JANUARY, 24, 22, 0, 0));
@@ -41,7 +40,7 @@ public class GigasecondTest {
41 40
         assertEquals(LocalDateTime.of(2046, Month.OCTOBER, 2, 23, 46, 40), gigaSecond.getDate());
42 41
     }
43 42
 
44
-    @Ignore
43
+    @Ignore("Remove to run test")
45 44
     @Test
46 45
     public void withFullTimeSpecifiedAndDayRollover() {
47 46
         Gigasecond gigaSecond = new Gigasecond(LocalDateTime.of(2015, Month.JANUARY, 24, 23, 59, 59));

+ 1
- 0
exercises/grade-school/build.gradle Dosyayı Görüntüle

@@ -10,6 +10,7 @@ dependencies {
10 10
   testCompile group: 'org.hamcrest', name: 'hamcrest-library', version: '1.3'
11 11
   testCompile "junit:junit:4.12"
12 12
 }
13
+
13 14
 test {
14 15
   testLogging {
15 16
     exceptionFormat = 'full'

+ 15
- 9
exercises/grade-school/src/test/java/SchoolTest.java Dosyayı Görüntüle

@@ -1,3 +1,4 @@
1
+import org.junit.Before;
1 2
 import org.junit.Ignore;
2 3
 import org.junit.Test;
3 4
 
@@ -15,21 +16,26 @@ import static org.junit.Assert.assertTrue;
15 16
 import static org.junit.Assert.assertEquals;
16 17
 
17 18
 public class SchoolTest {
18
-  private final School school = new School();
19
+  private School school;
20
+
21
+  @Before
22
+  public void setUp() {
23
+    school = new School();
24
+  }
19 25
 
20 26
   @Test
21 27
   public void startsWithNoStudents() {
22 28
     assertThat(school.numberOfStudents(), is(0));
23 29
   }
24 30
 
25
-  @Ignore
31
+  @Ignore("Remove to run test")
26 32
   @Test
27 33
   public void addsStudents() {
28 34
     school.add("Aimee", 2);
29 35
     assertThat(school.grade(2), hasItem("Aimee"));
30 36
   }
31 37
 
32
-  @Ignore
38
+  @Ignore("Remove to run test")
33 39
   @Test
34 40
   public void addsMoreStudentsInSameGrade() {
35 41
     final int grade = 2;
@@ -41,7 +47,7 @@ public class SchoolTest {
41 47
     assertThat(school.grade(grade), allOf(hasItem("James"), hasItem("Blair"), hasItem("Paul")));
42 48
   }
43 49
 
44
-  @Ignore
50
+  @Ignore("Remove to run test")
45 51
   @Test
46 52
   public void addsStudentsInMultipleGrades() {
47 53
     school.add("Chelsea", 3);
@@ -54,13 +60,13 @@ public class SchoolTest {
54 60
     assertThat(school.grade(7), hasItem("Logan"));
55 61
   }
56 62
 
57
-  @Ignore
63
+  @Ignore("Remove to run test")
58 64
   @Test
59 65
   public void getsStudentsInEmptyGrade() {
60 66
     assertTrue(school.grade(1).isEmpty());
61 67
   }
62 68
 
63
-  @Ignore
69
+  @Ignore("Remove to run test")
64 70
   @Test
65 71
   public void sortsSchool() {
66 72
     school.add("Kyle", 4);
@@ -85,7 +91,7 @@ public class SchoolTest {
85 91
     }
86 92
   }
87 93
 
88
-  @Ignore
94
+  @Ignore("Remove to run test")
89 95
   @Test
90 96
   public void modifyingFetchedGradeShouldNotModifyInternalDatabase() {
91 97
     String shouldNotBeAdded = "Should not be added to school";
@@ -103,7 +109,7 @@ public class SchoolTest {
103 109
     assertThat(school.grade(grade), not(hasItem(shouldNotBeAdded)));
104 110
   }
105 111
 
106
-  @Ignore
112
+  @Ignore("Remove to run test")
107 113
   @Test
108 114
   public void modifyingSortedStudentsShouldNotModifyInternalDatabase() {
109 115
     int grade = 2;
@@ -120,7 +126,7 @@ public class SchoolTest {
120 126
       // Such as UnsupportedOperationException when an unmodifiableMap is used
121 127
     }
122 128
 
123
-    assertThat(school.studentsByGradeAlphabetical().get(grade), 
129
+    assertThat(school.studentsByGradeAlphabetical().get(grade),
124 130
       not(hasItem(studentWhichShouldNotBeAdded)));
125 131
   }
126 132
 }

+ 1
- 0
exercises/hamming/build.gradle Dosyayı Görüntüle

@@ -9,6 +9,7 @@ repositories {
9 9
 dependencies {
10 10
   testCompile "junit:junit:4.12"
11 11
 }
12
+
12 13
 test {
13 14
   testLogging {
14 15
     exceptionFormat = 'full'

+ 11
- 2
exercises/hamming/src/example/java/Hamming.java Dosyayı Görüntüle

@@ -1,6 +1,15 @@
1 1
 public class Hamming {
2
+    private final int hammingDistance;
2 3
 
3
-    public static int compute(String leftStrand, String rightStrand) {
4
+    public Hamming(String leftStrand, String rightStrand) {
5
+        hammingDistance = computeHammingDistance(leftStrand, rightStrand);
6
+    }
7
+
8
+    public int getHammingDistance() {
9
+        return hammingDistance;
10
+    }
11
+
12
+    private int computeHammingDistance(String leftStrand, String rightStrand) {
4 13
         if(leftStrand.length() != rightStrand.length()) {
5 14
             throw new IllegalArgumentException("leftStrand and rightStrand must be of equal length.");
6 15
         }
@@ -13,7 +22,7 @@ public class Hamming {
13 22
         return distance;
14 23
     }
15 24
 
16
-    private static int hammingContributionAt(int index, String leftStrand, String rightStrand) {
25
+    private int hammingContributionAt(int index, String leftStrand, String rightStrand) {
17 26
       return leftStrand.charAt(index) != rightStrand.charAt(index) ? 1 : 0;
18 27
     }
19 28
 

+ 9
- 0
exercises/hamming/src/main/java/Hamming.java Dosyayı Görüntüle

@@ -1,2 +1,11 @@
1 1
 public class Hamming {
2
+
3
+    Hamming(String leftStrand, String rightStrand) {
4
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
5
+    }
6
+
7
+    int getHammingDistance() {
8
+        throw new UnsupportedOperationException("Delete this statement and write your own implementation.");
9
+    }
10
+
2 11
 }

+ 17
- 18
exercises/hamming/src/test/java/HammingTest.java Dosyayı Görüntüle

@@ -7,64 +7,63 @@ import org.junit.Rule;
7 7
 import org.junit.rules.ExpectedException;
8 8
 
9 9
 public class HammingTest {
10
-    
11 10
 
12 11
     @Rule
13 12
     public ExpectedException thrown = ExpectedException.none();
14 13
     
15 14
     @Test
16 15
     public void testNoDifferenceBetweenIdenticalStrands() {
17
-        assertThat(Hamming.compute("A", "A"), is(0));
16
+        assertThat(new Hamming("A", "A").getHammingDistance(), is(0));
18 17
     }
19 18
 
20
-    @Ignore
19
+    @Ignore("Remove to run test")
21 20
     @Test
22 21
     public void testHammingDistanceForSingleNucleotideStrand() {
23
-        assertThat(Hamming.compute("A", "G"), is(1));
22
+        assertThat(new Hamming("A", "G").getHammingDistance(), is(1));
24 23
     }
25 24
 
26
-    @Ignore
25
+    @Ignore("Remove to run test")
27 26
     @Test
28 27
     public void testHammingDistanceForSmallStrand() {
29
-        assertThat(Hamming.compute("AG", "CT"), is(2)); 
28
+        assertThat(new Hamming("AG", "CT").getHammingDistance(), is(2));
30 29
     }
31 30
 
32
-    @Ignore
31
+    @Ignore("Remove to run test")
33 32
     @Test
34 33
     public void testSmallHammingDistance() {
35
-        assertThat(Hamming.compute("AT", "CT"), is(1));
34
+        assertThat(new Hamming("AT", "CT").getHammingDistance(), is(1));
36 35
     }
37 36
 
38
-    @Ignore
37
+    @Ignore("Remove to run test")
39 38
     @Test
40 39
     public void testSmallHammingDistanceInLongerStrand() {
41
-        assertThat(Hamming.compute("GGACG", "GGTCG"), is(1));
40
+        assertThat(new Hamming("GGACG", "GGTCG").getHammingDistance(), is(1));
42 41
     }
43 42
 
44
-    @Ignore
43
+    @Ignore("Remove to run test")
45 44
     @Test
46 45
     public void testValidatesFirstStrandNotLonger() {
47 46
         thrown.expect(IllegalArgumentException.class);
48
-        Hamming.compute("AAAG", "AAA");                
47
+        new Hamming("AAAG", "AAA");
49 48
     }
50 49
 
51
-    @Ignore
50
+    @Ignore("Remove to run test")
52 51
     @Test
53 52
     public void testValidatesOtherStrandNotLonger() {
54 53
         thrown.expect(IllegalArgumentException.class);
55
-        Hamming.compute("AAA", "AAAG");
54
+        new Hamming("AAA", "AAAG");
56 55
     }
57 56
 
58
-    @Ignore
57
+    @Ignore("Remove to run test")
59 58
     @Test
60 59
     public void testLargeHammingDistance() {
61
-        assertThat(Hamming.compute("GATACA", "GCATAA"), is(4));
60
+        assertThat(new Hamming("GATACA", "GCATAA").getHammingDistance(), is(4));
62 61
     }
63 62
 
64
-    @Ignore
63
+    @Ignore("Remove to run test")
65 64
     @Test
66 65
     public void testHammingDistanceInVeryLongStrand() {
67
-        assertThat(Hamming.compute("GGACGGATTCTG", "AGGACGGATTCT"), is(9));
66
+        assertThat(new Hamming("GGACGGATTCTG", "AGGACGGATTCT").getHammingDistance(), is(9));
68 67
     }
69 68
 
70 69
 }

+ 5
- 1
exercises/hello-world/GETTING_STARTED.md Dosyayı Görüntüle

@@ -5,7 +5,7 @@ This guide picks-up where [Running the Tests (in Java)](http://exercism.io/langu
5 5
 left off.  If you haven't reviewed those instructions, do so now.
6 6
 
7 7
 Need more information?  A **step-by-step tutorial** is available in this directory at TUTORIAL.md or you can read 
8
-the [HTML version](https://github.com/exercism/xjava/blob/master/exercises/hello-world/TUTORIAL.md).
8
+the [HTML version](https://github.com/exercism/java/blob/master/exercises/hello-world/TUTORIAL.md).
9 9
 
10 10
 The following instructions work equally well on Windows, Mac OS X and Linux.
11 11
 
@@ -18,6 +18,10 @@ Try writing a solution that passes one test at a time, running Gradle each time:
18 18
 $ gradle test
19 19
 ```
20 20
 
21
+To help you focus on one test at a time, [@Ignore](http://junit.sourceforge.net/javadoc/org/junit/Ignore.html)
22
+annotations have been added to every test but the first one. Any test with an `@Ignore` annotation will be skipped
23
+when you run the tests.
24
+
21 25
 ## Iterate through the tests
22 26
 
23 27
 After your first test passes, remove the `@Ignore` from the next test, and iterate on your solution,

+ 0
- 0
exercises/hello-world/HINT.md Dosyayı Görüntüle


Bu fark içinde çok fazla dosya değişikliği olduğu için bazı dosyalar gösterilmiyor