trackler 2.2.1.88 → 2.2.1.89

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/lib/trackler/version.rb +1 -1
  3. data/problem-specifications/exercises/bowling/canonical-data.json +95 -39
  4. data/problem-specifications/exercises/gigasecond/canonical-data.json +17 -7
  5. data/problem-specifications/exercises/pangram/canonical-data.json +32 -12
  6. data/problem-specifications/exercises/say/canonical-data.json +47 -17
  7. data/problem-specifications/exercises/sum-of-multiples/canonical-data.json +54 -28
  8. data/problem-specifications/exercises/triangle/canonical-data.json +52 -18
  9. data/problem-specifications/exercises/two-bucket/canonical-data.json +38 -26
  10. data/problem-specifications/exercises/two-fer/canonical-data.json +14 -8
  11. data/problem-specifications/exercises/word-count/canonical-data.json +35 -13
  12. data/problem-specifications/exercises/wordy/canonical-data.json +50 -18
  13. data/tracks/bash/exercises/leap/.meta/version +1 -0
  14. data/tracks/bash/exercises/leap/example.sh +9 -9
  15. data/tracks/bash/exercises/leap/leap_test.sh +17 -33
  16. data/tracks/ceylon/exercises/anagram/source/anagram/AnagramTest.ceylon +1 -1
  17. data/tracks/ceylon/exercises/bracket-push/source/bracketpush/BracketsTest.ceylon +1 -1
  18. data/tracks/ceylon/exercises/rna-transcription/source/rnatranscription/RNATest.ceylon +2 -1
  19. data/tracks/fsharp/build.cake +2 -7
  20. data/tracks/fsharp/exercises/acronym/AcronymTest.fs +1 -1
  21. data/tracks/fsharp/exercises/all-your-base/AllYourBase.fs +1 -1
  22. data/tracks/fsharp/exercises/all-your-base/AllYourBaseTest.fs +43 -43
  23. data/tracks/fsharp/exercises/all-your-base/Example.fs +5 -5
  24. data/tracks/fsharp/exercises/allergies/AllergiesTest.fs +1 -1
  25. data/tracks/fsharp/exercises/alphametics/AlphameticsTest.fs +19 -1
  26. data/tracks/fsharp/exercises/alphametics/Example.fs +53 -34
  27. data/tracks/fsharp/exercises/anagram/AnagramTest.fs +1 -1
  28. data/tracks/fsharp/exercises/atbash-cipher/AtbashCipherTest.fs +1 -1
  29. data/tracks/fsharp/exercises/beer-song/BeerSongTest.fs +1 -1
  30. data/tracks/fsharp/exercises/binary-search/BinarySearchTest.fs +1 -1
  31. data/tracks/fsharp/exercises/bob/BobTest.fs +1 -1
  32. data/tracks/fsharp/exercises/book-store/BookStoreTest.fs +1 -1
  33. data/tracks/fsharp/exercises/bracket-push/BracketPushTest.fs +1 -1
  34. data/tracks/fsharp/exercises/change/ChangeTest.fs +1 -1
  35. data/tracks/fsharp/exercises/collatz-conjecture/CollatzConjectureTest.fs +1 -1
  36. data/tracks/fsharp/exercises/connect/ConnectTest.fs +1 -1
  37. data/tracks/fsharp/exercises/crypto-square/CryptoSquareTest.fs +1 -1
  38. data/tracks/fsharp/exercises/difference-of-squares/DifferenceOfSquaresTest.fs +1 -1
  39. data/tracks/fsharp/exercises/dominoes/DominoesTest.fs +25 -25
  40. data/tracks/fsharp/exercises/etl/EtlTest.fs +8 -8
  41. data/tracks/fsharp/exercises/isbn-verifier/IsbnVerifierTest.fs +5 -1
  42. data/tracks/fsharp/exercises/luhn/LuhnTest.fs +1 -1
  43. data/tracks/fsharp/exercises/meetup/Example.fs +11 -11
  44. data/tracks/fsharp/exercises/meetup/Meetup.fs +2 -2
  45. data/tracks/fsharp/exercises/meetup/MeetupTest.fs +96 -96
  46. data/tracks/fsharp/exercises/robot-simulator/Example.fs +21 -21
  47. data/tracks/fsharp/exercises/robot-simulator/RobotSimulator.fs +5 -5
  48. data/tracks/fsharp/exercises/robot-simulator/RobotSimulatorTest.fs +78 -96
  49. data/tracks/fsharp/generators/CanonicalData.fs +50 -4
  50. data/tracks/fsharp/generators/Common.fs +4 -13
  51. data/tracks/fsharp/generators/Exercise.fs +31 -15
  52. data/tracks/fsharp/generators/Generators.fs +76 -111
  53. data/tracks/haskell/exercises/alphametics/package.yaml +1 -1
  54. data/tracks/haskell/exercises/alphametics/test/Tests.hs +5 -0
  55. data/tracks/haskell/exercises/bowling/package.yaml +1 -1
  56. data/tracks/haskell/exercises/pangram/package.yaml +1 -1
  57. data/tracks/haskell/exercises/say/package.yaml +1 -1
  58. data/tracks/haskell/exercises/sum-of-multiples/package.yaml +1 -1
  59. data/tracks/haskell/exercises/word-count/package.yaml +1 -1
  60. data/tracks/haskell/exercises/wordy/package.yaml +1 -1
  61. data/tracks/java/exercises/nucleotide-count/.meta/hints.md +58 -0
  62. data/tracks/java/exercises/nucleotide-count/README.md +62 -0
  63. metadata +4 -2
@@ -3,6 +3,7 @@ module Generators.Generators
3
3
  open System
4
4
  open System.Globalization
5
5
  open Newtonsoft.Json.Linq
6
+ open CanonicalData
6
7
  open Formatting
7
8
  open Rendering
8
9
  open Exercise
@@ -10,9 +11,6 @@ open Exercise
10
11
  type Acronym() =
11
12
  inherit GeneratorExercise()
12
13
 
13
- type AtbashCipher() =
14
- inherit GeneratorExercise()
15
-
16
14
  type AllYourBase() =
17
15
  inherit GeneratorExercise()
18
16
 
@@ -31,12 +29,13 @@ type Allergies() =
31
29
  override this.RenderTestMethodBody canonicalDataCase =
32
30
  if (canonicalDataCase.Property = "allergicTo") then
33
31
  let renderAssertion (jToken: JToken) =
34
- let updatedProperties =
35
- canonicalDataCase.Properties
32
+ let updatedInput =
33
+ canonicalDataCase.Input
36
34
  |> Map.add "substance" (jToken.["substance"] |> toAllergen |> box)
37
- |> Map.add "expected" (jToken.["result"].ToObject<bool>() |> box)
38
35
 
39
- { canonicalDataCase with Properties = updatedProperties }
36
+ { canonicalDataCase with
37
+ Input = updatedInput
38
+ Expected = jToken.["result"].ToObject<bool>() |> box }
40
39
  |> this.RenderAssert
41
40
  |> indent 1
42
41
 
@@ -90,18 +89,15 @@ type Anagram() =
90
89
  type ArmstrongNumbers() =
91
90
  inherit GeneratorExercise()
92
91
 
93
- override __.RenderInput (_, _, value) =
94
- (value :?> JToken).Value("number")
95
- |> formatValue
92
+ type AtbashCipher() =
93
+ inherit GeneratorExercise()
96
94
 
97
95
  type BeerSong() =
98
96
  inherit GeneratorExercise()
99
97
 
100
- override __.PropertiesUsedAsSutParameter _ = ["startBottles"; "takeDown"]
101
-
102
98
  override __.PropertiesWithIdentifier _ = ["expected"]
103
99
 
104
- override __.RenderExpected (_, key, value) =
100
+ override __.RenderExpected (_, _, value) =
105
101
  (value :?> JArray)
106
102
  |> normalizeJArray
107
103
  |> Seq.map formatValue
@@ -148,10 +144,10 @@ type Change() =
148
144
 
149
145
  override this.PropertiesWithIdentifier canonicalDataCase = this.Properties canonicalDataCase
150
146
 
151
- override __.IdentifierTypeAnnotation (canonicalDataCase, key, _) =
152
- match key with
153
- | "expected" ->
154
- match canonicalDataCase.Properties.["target"] :?> int64 with
147
+ override __.IdentifierTypeAnnotation (canonicalDataCase, key, _) =
148
+ match key with
149
+ | "expected" ->
150
+ match canonicalDataCase.Input.["target"] :?> int64 with
155
151
  | 0L -> Some "int list option"
156
152
  | _ -> None
157
153
  | _ -> None
@@ -329,6 +325,9 @@ type Etl() =
329
325
 
330
326
  override this.RenderExpected (_, _, value) = this.FormatMap<char, int> value
331
327
 
328
+ override __.MapCanonicalDataCaseInput (canonicalDataCase, _) =
329
+ Map.empty |> Map.add "lettersByScore" (canonicalDataCase.Properties.["input"])
330
+
332
331
  override this.PropertiesWithIdentifier canonicalDataCase = this.Properties canonicalDataCase
333
332
 
334
333
  type FoodChain() =
@@ -487,38 +486,37 @@ type Markdown() =
487
486
  type Meetup() =
488
487
  inherit GeneratorExercise()
489
488
 
490
- override __.RenderExpected (canonicalDataCase, _, _) =
491
- let year = canonicalDataCase.Properties.["year"] :?> int64 |> int
492
- let month = canonicalDataCase.Properties.["month"] :?> int64 |> int
493
- let day = canonicalDataCase.Properties.["dayofmonth"] :?> int64 |> int
494
- DateTime(year, month, day) |> formatDateTime |> parenthesize
489
+ override __.RenderExpected (_, _, value) =
490
+ DateTime.Parse(string value)
491
+ |> formatDateTime
492
+ |> parenthesize
495
493
 
496
494
  override __.RenderInput (canonicalDataCase, key, value) =
497
495
  match key with
498
496
  | "dayofweek" ->
499
- sprintf "DayOfWeek.%s" (string canonicalDataCase.Properties.["dayofweek"])
497
+ sprintf "DayOfWeek.%s" (string canonicalDataCase.Input.["dayofweek"])
500
498
  | "week" ->
501
- sprintf "Schedule.%s" (string canonicalDataCase.Properties.["week"] |> String.upperCaseFirst)
499
+ sprintf "Week.%s" (string canonicalDataCase.Input.["week"] |> String.upperCaseFirst)
502
500
  | _ ->
503
501
  base.RenderInput (canonicalDataCase, key, value)
504
502
 
505
- override __.MapCanonicalDataCaseProperties (_, properties) =
506
- properties |> Map.add "expected" null // Ensure that the "expected" key exists
507
-
508
- override __.PropertiesUsedAsSutParameter _ =
509
- ["year"; "month"; "dayofweek"; "week"]
503
+ override __.PropertiesUsedAsSutParameter _ = ["year"; "month"; "week"; "dayofweek"]
510
504
 
511
505
  override __.AdditionalNamespaces = [typeof<DateTime>.Namespace]
512
506
 
513
507
  type Minesweeper() =
514
508
  inherit GeneratorExercise()
515
509
 
516
- override __.RenderValueWithoutIdentifier (_, _, value) =
510
+ let renderValue (value: obj) =
517
511
  value :?> JArray
518
512
  |> normalizeJArray
519
513
  |> Seq.map formatValue
520
514
  |> formatMultiLineList
521
515
 
516
+ override __.RenderInput (_, _, value) = renderValue value
517
+
518
+ override __.RenderExpected (_, _, value) = renderValue value
519
+
522
520
  override this.PropertiesWithIdentifier canonicalDataCase = this.Properties canonicalDataCase
523
521
 
524
522
  override __.IdentifierTypeAnnotation (_, _, value) =
@@ -691,10 +689,10 @@ type Proverb() =
691
689
  type QueenAttack() =
692
690
  inherit GeneratorExercise()
693
691
 
694
- override __.MapCanonicalDataCaseProperty (canonicalDataCase, key, value) =
695
- match canonicalDataCase.Property, key, value with
696
- | "create", "expected", _ -> value :?> int64 <> -1L |> box
697
- | _ -> base.MapCanonicalDataCaseProperty (canonicalDataCase, key, value)
692
+ override __.MapCanonicalDataCaseExpected (canonicalDataCase, key, value) =
693
+ match canonicalDataCase.Property with
694
+ | "create" -> value :?> int64 <> -1L |> box
695
+ | _ -> base.MapCanonicalDataCaseInputProperty (canonicalDataCase, key, value)
698
696
 
699
697
  override __.RenderInput (canonicalDataCase, key, value) =
700
698
  let parsePositionTuple (tupleValue: obj) =
@@ -828,94 +826,61 @@ type ReverseString() =
828
826
  type RobotSimulator() =
829
827
  inherit GeneratorExercise()
830
828
 
831
- let resultIdentifierName = "actual"
829
+ let parseInput (input: obj) =
830
+ let token = input :?> JToken
831
+ let direction = token.SelectToken "direction" |> Option.ofObj
832
+ let position = token.SelectToken "position" |> Option.ofObj
833
+ (direction, position)
832
834
 
833
- override __.PropertiesWithIdentifier _ = ["robot"; "property"; "expected"]
835
+ let renderDirection (value: JToken) =
836
+ value.ToObject<string>() |> String.upperCaseFirst
834
837
 
835
- member private __.RenderDirection (value: JToken) =
836
- sprintf "%s" (value.ToObject<string>() |> String.upperCaseFirst)
837
-
838
- member private __.RenderCoords (coords: JToken) =
839
- (coords.["x"].ToObject<int>(), coords.["y"].ToObject<int>())
838
+ let renderPosition (position: JToken) =
839
+ (position.["x"].ToObject<int>(), position.["y"].ToObject<int>())
840
840
  |> formatValue
841
841
 
842
- member private this.DefineRobot (direction: JToken) (coords: JToken) =
843
- sprintf "createRobot %s %s" (this.RenderDirection direction) (this.RenderCoords coords)
842
+ let renderRobot direction position =
843
+ sprintf "create %s %s" (renderDirection direction) (renderPosition position)
844
844
 
845
- member private __.GetRobotProperties (value : JToken) =
846
- value.SelectToken("direction"), value.SelectToken("position")
845
+ let renderInput input =
846
+ match input with
847
+ | None, Some position -> renderPosition position
848
+ | Some direction, None -> renderDirection direction
849
+ | Some direction, Some position -> renderRobot direction position
850
+ | None, None -> failwith "No direction or position"
847
851
 
848
- override __.RenderArrange canonicalDataCase =
849
- // one identifier may be empty if we only checking created object
850
- // we need to filter out this empty line
851
- base.RenderArrange canonicalDataCase
852
- |> List.choose (
853
- function
854
- | "" -> None
855
- | v -> Some v
856
- )
852
+ override __.PropertiesWithIdentifier canonicalDataCase =
853
+ match parseInput canonicalDataCase.Expected with
854
+ | None, Some _ -> ["robot"; "sut"]
855
+ | Some _, None -> ["robot"; "sut"]
856
+ | Some _, Some _ -> ["robot"; "expected"]
857
+ | None, None -> ["robot"; "sut"; "expected"]
858
+
859
+ override __.ToTestMethodBodyAssert canonicalDataCase =
860
+ let testMethodBodyAssert = base.ToTestMethodBodyAssert(canonicalDataCase)
857
861
 
858
- override this.RenderValueWithoutIdentifier (_, key, value) =
862
+ match parseInput canonicalDataCase.Expected with
863
+ | None, Some _ -> { testMethodBodyAssert with Sut = sprintf "%s.position" testMethodBodyAssert.Sut }
864
+ | Some _, None -> { testMethodBodyAssert with Sut = sprintf "%s.direction" testMethodBodyAssert.Sut }
865
+ | _ -> testMethodBodyAssert
866
+
867
+ override __.RenderValueWithoutIdentifier (canonicalDataCase, key, value) =
859
868
  match key with
860
- | "robot" ->
861
- let input = value :?> JToken
862
- this.DefineRobot ("direction" |> input.SelectToken) ("position" |> input.SelectToken)
863
- | "expected" ->
864
- // here we may need to render full robot object
865
- // or just coordinate/direction values
866
- let input = value :?> JToken
867
- let direction, position = this.GetRobotProperties input
868
- match isNull direction, isNull position with
869
- | true, false ->
870
- this.RenderCoords position
871
- | false, true ->
872
- this.RenderDirection direction
873
- | false, false ->
874
- this.DefineRobot ("direction" |> input.SelectToken) ("position" |> input.SelectToken)
875
- | true, true ->
876
- ""
877
- | _ -> ""
878
-
879
- override __.RenderValueWithIdentifier (canonicalDataCase, key, value) =
880
- match key with
881
- | "property" ->
882
- let action = value :?> string
883
- match action with
884
- | "instructions" ->
885
- sprintf "let %s = simulate robot %s" resultIdentifierName (canonicalDataCase.Properties.["instructions"] |> formatValue)
886
- | "create" ->
887
- ""
888
- | _ ->
889
- sprintf "let %s = %s robot" resultIdentifierName action
890
-
891
- | _ ->
892
- base.RenderValueWithIdentifier (canonicalDataCase, key, value)
869
+ | "robot" -> value |> parseInput |> renderInput
870
+ | "expected" -> value |> parseInput |> renderInput
871
+ | _ -> base.RenderValueWithoutIdentifier (canonicalDataCase, key, value)
893
872
 
894
- override this.RenderSut canonicalDataCase =
873
+ override __.RenderSut canonicalDataCase =
895
874
  match canonicalDataCase.Property with
896
- | "create" ->
897
- "robot"
898
- | _ ->
899
- // depends on expected value we may need to
900
- // check whole robot or just one of its' properties
901
- let direction, position = this.GetRobotProperties (canonicalDataCase.Properties.["expected"] :?> JToken)
902
- match isNull direction, isNull position with
903
- | true, false ->
904
- sprintf "%s.coordinate" resultIdentifierName
905
- | false, true ->
906
- sprintf "%s.bearing" resultIdentifierName
907
- | true, true ->
908
- resultIdentifierName
909
- | false, false ->
910
- match canonicalDataCase.Property with
911
- | "create" -> "robot"
912
- | _ -> resultIdentifierName
913
-
875
+ | "create" -> "robot"
876
+ | _ -> base.RenderSut canonicalDataCase
877
+
914
878
  override __.RenderTestMethodName canonicalDataCase =
915
- // avoid duplicated method names
916
- // for this generator it is preferable
917
- // because useFullMethodName leads to very long names
918
- sprintf "%s - %s" canonicalDataCase.Property (canonicalDataCase.Description |> String.upperCaseFirst)
879
+ let testMethodName = base.RenderTestMethodName canonicalDataCase
880
+
881
+ match canonicalDataCase.Property with
882
+ | "create" | "instructions" -> testMethodName
883
+ | _ -> sprintf "%s %s" canonicalDataCase.Property (String.lowerCaseFirst testMethodName)
919
884
 
920
885
  type RotationalCipher() =
921
886
  inherit GeneratorExercise()
@@ -1,5 +1,5 @@
1
1
  name: alphametics
2
- version: 1.0.0.3
2
+ version: 1.2.0.4
3
3
 
4
4
  dependencies:
5
5
  - base
@@ -63,6 +63,11 @@ cases = [ Case { description = "puzzle with three letters"
63
63
  -- , expected = Just [('A', 5), ('D', 3), ('E', 4), ('F', 7), ('G', 8),
64
64
  -- ('N', 0), ('O', 2), ('R', 1), ('S', 6), ('T', 9)]
65
65
  -- }
66
+ -- , Case { description = "puzzle with ten letters and 199 addends"
67
+ -- , puzzle = "THIS + A + FIRE + THEREFORE + FOR + ALL + HISTORIES + I + TELL + A + TALE + THAT + FALSIFIES + ITS + TITLE + TIS + A + LIE + THE + TALE + OF + THE + LAST + FIRE + HORSES + LATE + AFTER + THE + FIRST + FATHERS + FORESEE + THE + HORRORS + THE + LAST + FREE + TROLL + TERRIFIES + THE + HORSES + OF + FIRE + THE + TROLL + RESTS + AT + THE + HOLE + OF + LOSSES + IT + IS + THERE + THAT + SHE + STORES + ROLES + OF + LEATHERS + AFTER + SHE + SATISFIES + HER + HATE + OFF + THOSE + FEARS + A + TASTE + RISES + AS + SHE + HEARS + THE + LEAST + FAR + HORSE + THOSE + FAST + HORSES + THAT + FIRST + HEAR + THE + TROLL + FLEE + OFF + TO + THE + FOREST + THE + HORSES + THAT + ALERTS + RAISE + THE + STARES + OF + THE + OTHERS + AS + THE + TROLL + ASSAILS + AT + THE + TOTAL + SHIFT + HER + TEETH + TEAR + HOOF + OFF + TORSO + AS + THE + LAST + HORSE + FORFEITS + ITS + LIFE + THE + FIRST + FATHERS + HEAR + OF + THE + HORRORS + THEIR + FEARS + THAT + THE + FIRES + FOR + THEIR + FEASTS + ARREST + AS + THE + FIRST + FATHERS + RESETTLE + THE + LAST + OF + THE + FIRE + HORSES + THE + LAST + TROLL + HARASSES + THE + FOREST + HEART + FREE + AT + LAST + OF + THE + LAST + TROLL + ALL + OFFER + THEIR + FIRE + HEAT + TO + THE + ASSISTERS + FAR + OFF + THE + TROLL + FASTS + ITS + LIFE + SHORTER + AS + STARS + RISE + THE + HORSES + REST + SAFE + AFTER + ALL + SHARE + HOT + FISH + AS + THEIR + AFFILIATES + TAILOR + A + ROOFS + FOR + THEIR + SAFE == FORTRESSES"
68
+ -- , expected = Just [('A', 1), ('E', 0), ('F', 5), ('H', 8), ('I', 7),
69
+ -- ('L', 2), ('O', 6), ('R', 3), ('S', 4), ('T', 9)]
70
+ -- }
66
71
  -- , Case { description = "puzzle with multiplication"
67
72
  -- , puzzle = "IF * DR == DORI"
68
73
  -- , expected = Just [('I', 8), ('F', 2), ('D', 3), ('R', 9), ('O', 1)]
@@ -1,5 +1,5 @@
1
1
  name: bowling
2
- version: 1.0.1.4
2
+ version: 1.1.0.5
3
3
 
4
4
  dependencies:
5
5
  - base
@@ -1,5 +1,5 @@
1
1
  name: pangram
2
- version: 1.3.0.5
2
+ version: 1.4.0.6
3
3
 
4
4
  dependencies:
5
5
  - base
@@ -1,5 +1,5 @@
1
1
  name: say
2
- version: 1.0.0.3
2
+ version: 1.1.0.4
3
3
 
4
4
  dependencies:
5
5
  - base
@@ -1,5 +1,5 @@
1
1
  name: sum-of-multiples
2
- version: 1.1.0.4
2
+ version: 1.2.0.5
3
3
 
4
4
  dependencies:
5
5
  - base
@@ -1,5 +1,5 @@
1
1
  name: word-count
2
- version: 1.0.0.3
2
+ version: 1.1.0.4
3
3
 
4
4
  dependencies:
5
5
  - base
@@ -1,5 +1,5 @@
1
1
  name: wordy
2
- version: 1.0.0.3
2
+ version: 1.1.0.4
3
3
 
4
4
  dependencies:
5
5
  - base
@@ -0,0 +1,58 @@
1
+ Since this exercise has difficulty 5 it doesn't come with any starter implementation.
2
+ This is so that you get to practice creating classes and methods which is an important part of programming in Java.
3
+ It does mean that when you first try to run the tests, they won't compile.
4
+ They will give you an error similar to:
5
+ ```
6
+ path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbol
7
+ ExerciseClassName exerciseClassName = new ExerciseClassName();
8
+ ^
9
+ symbol: class ExerciseClassName
10
+ location: class ExerciseClassNameTest
11
+ ```
12
+ This error occurs because the test refers to a class that hasn't been created yet (`ExerciseClassName`).
13
+ To resolve the error you need to add a file matching the class name in the error to the `src/main/java` directory.
14
+ For example, for the error above you would add a file called `ExerciseClassName.java`.
15
+
16
+ When you try to run the tests again you will get slightly different errors.
17
+ You might get an error similar to:
18
+ ```
19
+ constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types;
20
+ ExerciseClassName exerciseClassName = new ExerciseClassName("some argument");
21
+ ^
22
+ required: no arguments
23
+ found: String
24
+ reason: actual and formal argument lists differ in length
25
+ ```
26
+ This error means that you need to add a [constructor](https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) to your new class.
27
+ If you don't add a constructor, Java will add a default one for you.
28
+ This default constructor takes no arguments.
29
+ So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.
30
+ In the example above you could add:
31
+ ```
32
+ ExerciseClassName(String input) {
33
+
34
+ }
35
+ ```
36
+ That should make the error go away, though you might need to add some more code to your constructor to make the test pass!
37
+
38
+ You might also get an error similar to:
39
+ ```
40
+ error: cannot find symbol
41
+ assertEquals(expectedOutput, exerciseClassName.someMethod());
42
+ ^
43
+ symbol: method someMethod()
44
+ location: variable exerciseClassName of type ExerciseClassName
45
+ ```
46
+ This error means that you need to add a method called `someMethod` to your new class.
47
+ In the example above you would add:
48
+ ```
49
+ String someMethod() {
50
+ return "";
51
+ }
52
+ ```
53
+ Make sure the return type matches what the test is expecting.
54
+ You can find out which return type it should have by looking at the type of object it's being compared to in the tests.
55
+ Or you could set your method to return some random type (e.g. `void`), and run the tests again.
56
+ The new error should tell you which type it's expecting.
57
+
58
+ After having resolved these errors you should be ready to start making the tests pass!
@@ -12,6 +12,68 @@ Here is an analogy:
12
12
  - legos are to lego houses as
13
13
  - words are to sentences as...
14
14
 
15
+ # Java Tips
16
+
17
+ Since this exercise has difficulty 5 it doesn't come with any starter implementation.
18
+ This is so that you get to practice creating classes and methods which is an important part of programming in Java.
19
+ It does mean that when you first try to run the tests, they won't compile.
20
+ They will give you an error similar to:
21
+ ```
22
+ path-to-exercism-dir\exercism\java\name-of-exercise\src\test\java\ExerciseClassNameTest.java:14: error: cannot find symbol
23
+ ExerciseClassName exerciseClassName = new ExerciseClassName();
24
+ ^
25
+ symbol: class ExerciseClassName
26
+ location: class ExerciseClassNameTest
27
+ ```
28
+ This error occurs because the test refers to a class that hasn't been created yet (`ExerciseClassName`).
29
+ To resolve the error you need to add a file matching the class name in the error to the `src/main/java` directory.
30
+ For example, for the error above you would add a file called `ExerciseClassName.java`.
31
+
32
+ When you try to run the tests again you will get slightly different errors.
33
+ You might get an error similar to:
34
+ ```
35
+ constructor ExerciseClassName in class ExerciseClassName cannot be applied to given types;
36
+ ExerciseClassName exerciseClassName = new ExerciseClassName("some argument");
37
+ ^
38
+ required: no arguments
39
+ found: String
40
+ reason: actual and formal argument lists differ in length
41
+ ```
42
+ This error means that you need to add a [constructor](https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html) to your new class.
43
+ If you don't add a constructor, Java will add a default one for you.
44
+ This default constructor takes no arguments.
45
+ So if the tests expect your class to have a constructor which takes arguments, then you need to create this constructor yourself.
46
+ In the example above you could add:
47
+ ```
48
+ ExerciseClassName(String input) {
49
+
50
+ }
51
+ ```
52
+ That should make the error go away, though you might need to add some more code to your constructor to make the test pass!
53
+
54
+ You might also get an error similar to:
55
+ ```
56
+ error: cannot find symbol
57
+ assertEquals(expectedOutput, exerciseClassName.someMethod());
58
+ ^
59
+ symbol: method someMethod()
60
+ location: variable exerciseClassName of type ExerciseClassName
61
+ ```
62
+ This error means that you need to add a method called `someMethod` to your new class.
63
+ In the example above you would add:
64
+ ```
65
+ String someMethod() {
66
+ return "";
67
+ }
68
+ ```
69
+ Make sure the return type matches what the test is expecting.
70
+ You can find out which return type it should have by looking at the type of object it's being compared to in the tests.
71
+ Or you could set your method to return some random type (e.g. `void`), and run the tests again.
72
+ The new error should tell you which type it's expecting.
73
+
74
+ After having resolved these errors you should be ready to start making the tests pass!
75
+
76
+
15
77
  # Running the tests
16
78
 
17
79
  You can run all the tests for an exercise by entering