diff --git a/.idea/compiler.xml b/.idea/compiler.xml
new file mode 100644
index 0000000..7befbf4
--- /dev/null
+++ b/.idea/compiler.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml
new file mode 100644
index 0000000..e7bedf3
--- /dev/null
+++ b/.idea/copyright/profiles_settings.xml
@@ -0,0 +1,3 @@
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..71882d5
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..883bccf
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/com/thoughtworks/core/Convert.java b/src/main/java/com/thoughtworks/core/Convert.java
new file mode 100644
index 0000000..afc635f
--- /dev/null
+++ b/src/main/java/com/thoughtworks/core/Convert.java
@@ -0,0 +1,29 @@
+package com.thoughtworks.core;
+
+/**
+ * Created by hliang on 14/12/2016.
+ */
+public class Convert {
+ private Core core;
+
+ public Convert(Core p0) {
+ core = p0;
+ }
+
+ public String[] convertToNumberDescriptions(int max) {
+ String[] res = new String[max];
+ for (int i = 0; i < max; i++) {
+ res[i] = core.convertToNumberDescription(i+1);
+ }
+ return res;
+ }
+
+ public static void main(String[] args) {
+ Core core = new Core();
+ Convert convert = new Convert(core);
+ String[] numberDescriptions = convert.convertToNumberDescriptions(100);
+ for (String numberDescription : numberDescriptions) {
+ System.out.println(numberDescription);
+ }
+ }
+}
diff --git a/src/main/java/com/thoughtworks/core/Core.java b/src/main/java/com/thoughtworks/core/Core.java
new file mode 100644
index 0000000..9132c77
--- /dev/null
+++ b/src/main/java/com/thoughtworks/core/Core.java
@@ -0,0 +1,17 @@
+package com.thoughtworks.core;
+
+/**
+ * Created by hliang on 13/12/2016.
+ */
+public class Core {
+ public String convertToNumberDescription(int number) {
+ if (number % 3 == 0 && number % 5 == 0) {
+ return "FizzBuzz";
+ } else if (number % 3 == 0) {
+ return "Fizz";
+ } else if (number % 5 == 0) {
+ return "Buzz";
+ }
+ return ""+number;
+ }
+}
diff --git a/src/test/java/com/thoughtworks/core/ConvertTest.java b/src/test/java/com/thoughtworks/core/ConvertTest.java
new file mode 100644
index 0000000..710318e
--- /dev/null
+++ b/src/test/java/com/thoughtworks/core/ConvertTest.java
@@ -0,0 +1,47 @@
+package com.thoughtworks.core;
+
+import org.junit.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+/**
+ * Created by hliang on 14/12/2016.
+ */
+public class ConvertTest {
+ @Test
+ public void should_return_array0_given_0 () {
+ //given
+ Core core = new Core();
+ Convert convert = new Convert(core);
+ //when
+ String[] result = convert.convertToNumberDescriptions(0);
+ //then
+ assertThat(result).isEqualTo(new String[0]);
+ }
+ @Test
+ public void should_return_array1_given_1 () {
+ //given
+ Core core = mock(Core.class);
+ Convert convert = new Convert(core);
+ when(core.convertToNumberDescription(1)).thenReturn("1");
+ //when
+ String[] result = convert.convertToNumberDescriptions(1);
+ //then
+ assertThat(result).isEqualTo(new String[]{"1"});
+ }
+ @Test
+ public void should_return_array3_given_3 () {
+ //given
+ Core core = mock(Core.class);
+ Convert convert = new Convert(core);
+ when(core.convertToNumberDescription(1)).thenReturn("1");
+ when(core.convertToNumberDescription(2)).thenReturn("2");
+ when(core.convertToNumberDescription(3)).thenReturn("Fizz");
+ //when
+ String[] result = convert.convertToNumberDescriptions(3);
+ //then
+ assertThat(result).isEqualTo(new String[]{"1","2","Fizz"});
+ }
+}
diff --git a/src/test/java/com/thoughtworks/core/CoreTest.java b/src/test/java/com/thoughtworks/core/CoreTest.java
new file mode 100644
index 0000000..5bf398a
--- /dev/null
+++ b/src/test/java/com/thoughtworks/core/CoreTest.java
@@ -0,0 +1,55 @@
+package com.thoughtworks.core;
+import org.junit.Test;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Created by hliang on 13/12/2016.
+ */
+public class CoreTest {
+ @Test
+ public void should_return_1_given_1 () {
+ //given
+ int number = 1;
+ //when
+ String actualValue = new Core().convertToNumberDescription(number);
+ //then
+ assertThat(actualValue).isEqualTo("1");
+ }
+ @Test
+ public void should_return_Fizz_given_3 () {
+ //given
+ int number = 3;
+ //when
+ String actualValue = new Core().convertToNumberDescription(number);
+ //then
+ assertThat(actualValue).isEqualTo("Fizz");
+ }
+ @Test
+ public void should_return_Buzz_given_5 () {
+ //given
+ int number = 5;
+ //when
+ String actualValue = new Core().convertToNumberDescription(number);
+ //then
+ assertThat(actualValue).isEqualTo("Buzz");
+ }
+ @Test
+ public void should_return_FizzBuzz_given_15 () {
+ //given
+ int number = 15;
+ //when
+ String actualValue = new Core().convertToNumberDescription(number);
+ //then
+ assertThat(actualValue).isEqualTo("FizzBuzz");
+ }
+ @Test
+ public void should_return_16_given_16 () {
+ //given
+ int number = 16;
+ //when
+ String actualValue = new Core().convertToNumberDescription(number);
+ //then
+ assertThat(actualValue).isEqualTo("16");
+ }
+}
\ No newline at end of file