Quellcode durchsuchen

add project files

Froilan Miranda vor 7 Jahren
Ursprung
Commit
0e0f7afdd0

+ 32
- 0
.idea/compiler.xml Datei anzeigen

@@ -0,0 +1,32 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="CompilerConfiguration">
4
+    <resourceExtensions />
5
+    <wildcardResourcePatterns>
6
+      <entry name="!?*.java" />
7
+      <entry name="!?*.form" />
8
+      <entry name="!?*.class" />
9
+      <entry name="!?*.groovy" />
10
+      <entry name="!?*.scala" />
11
+      <entry name="!?*.flex" />
12
+      <entry name="!?*.kt" />
13
+      <entry name="!?*.clj" />
14
+      <entry name="!?*.aj" />
15
+    </wildcardResourcePatterns>
16
+    <annotationProcessing>
17
+      <profile default="true" name="Default" enabled="false">
18
+        <processorPath useClasspath="true" />
19
+      </profile>
20
+      <profile default="false" name="Maven default annotation processors profile" enabled="true">
21
+        <sourceOutputDir name="target/generated-sources/annotations" />
22
+        <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
23
+        <outputRelativeToContentRoot value="true" />
24
+        <processorPath useClasspath="true" />
25
+        <module name="conversion" />
26
+      </profile>
27
+    </annotationProcessing>
28
+    <bytecodeTargetLevel>
29
+      <module name="conversion" target="1.5" />
30
+    </bytecodeTargetLevel>
31
+  </component>
32
+</project>

+ 3
- 0
.idea/copyright/profiles_settings.xml Datei anzeigen

@@ -0,0 +1,3 @@
1
+<component name="CopyrightManager">
2
+  <settings default="" />
3
+</component>

+ 6
- 0
.idea/encodings.xml Datei anzeigen

@@ -0,0 +1,6 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="Encoding">
4
+    <file url="PROJECT" charset="UTF-8" />
5
+  </component>
6
+</project>

+ 42
- 0
.idea/misc.xml Datei anzeigen

@@ -0,0 +1,42 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="EntryPointsManager">
4
+    <entry_points version="2.0" />
5
+  </component>
6
+  <component name="MavenProjectsManager">
7
+    <option name="originalFiles">
8
+      <list>
9
+        <option value="$PROJECT_DIR$/pom.xml" />
10
+      </list>
11
+    </option>
12
+  </component>
13
+  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
14
+    <OptionsSetting value="true" id="Add" />
15
+    <OptionsSetting value="true" id="Remove" />
16
+    <OptionsSetting value="true" id="Checkout" />
17
+    <OptionsSetting value="true" id="Update" />
18
+    <OptionsSetting value="true" id="Status" />
19
+    <OptionsSetting value="true" id="Edit" />
20
+    <ConfirmationsSetting value="0" id="Add" />
21
+    <ConfirmationsSetting value="0" id="Remove" />
22
+  </component>
23
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
24
+    <output url="file://$PROJECT_DIR$/out" />
25
+  </component>
26
+  <component name="masterDetails">
27
+    <states>
28
+      <state key="ProjectJDKs.UI">
29
+        <settings>
30
+          <last-edited>1.8</last-edited>
31
+          <splitter-proportions>
32
+            <option name="proportions">
33
+              <list>
34
+                <option value="0.2" />
35
+              </list>
36
+            </option>
37
+          </splitter-proportions>
38
+        </settings>
39
+      </state>
40
+    </states>
41
+  </component>
42
+</project>

+ 8
- 0
.idea/modules.xml Datei anzeigen

@@ -0,0 +1,8 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project version="4">
3
+  <component name="ProjectModuleManager">
4
+    <modules>
5
+      <module fileurl="file://$PROJECT_DIR$/conversion.iml" filepath="$PROJECT_DIR$/conversion.iml" />
6
+    </modules>
7
+  </component>
8
+</project>

+ 17
- 0
conversion.iml Datei anzeigen

@@ -0,0 +1,17 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
+  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
4
+    <output url="file://$MODULE_DIR$/target/classes" />
5
+    <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
+    <content url="file://$MODULE_DIR$">
7
+      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8
+      <sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
9
+      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
10
+      <excludeFolder url="file://$MODULE_DIR$/target" />
11
+    </content>
12
+    <orderEntry type="inheritedJdk" />
13
+    <orderEntry type="sourceFolder" forTests="false" />
14
+    <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
15
+    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
16
+  </component>
17
+</module>

+ 20
- 0
pom.xml Datei anzeigen

@@ -0,0 +1,20 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<project xmlns="http://maven.apache.org/POM/4.0.0"
3
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
+    <modelVersion>4.0.0</modelVersion>
6
+
7
+    <groupId>io.zipcoder</groupId>
8
+    <artifactId>conversion</artifactId>
9
+    <version>1.0-SNAPSHOT</version>
10
+
11
+    <dependencies>
12
+        <dependency>
13
+            <groupId>junit</groupId>
14
+            <artifactId>junit</artifactId>
15
+            <version>4.12</version>
16
+            <scope>test</scope>
17
+        </dependency>
18
+    </dependencies>
19
+
20
+</project>

+ 21
- 0
src/main/java/ConversionTool.java Datei anzeigen

@@ -0,0 +1,21 @@
1
+public class ConversionTool {
2
+
3
+
4
+    public static void main(String[] args){}
5
+
6
+    public static float CentimetersToInches(float centimeters){}
7
+
8
+    public static float InchesToCentimeters(float inches){}
9
+
10
+    public static float FeetToMeters(float feet){}
11
+
12
+    public static float MetersToFeet(float meters){}
13
+
14
+    public static float CelsiusToFahrenheit(float celsius){}
15
+
16
+    public static float FahrenheitToCelsius(float fahrenheit){}
17
+
18
+    public static float MphToKph(float mph){}
19
+
20
+    public static float KphToMph(float kph){}
21
+}

+ 113
- 0
src/test/java/ConversionToolSpec.java Datei anzeigen

@@ -0,0 +1,113 @@
1
+import static org.junit.Assert.assertEquals;
2
+import org.junit.Test;
3
+
4
+public class ConversionToolSpec {
5
+
6
+    @Test
7
+    public void shouldConvertCentimetersToInches() {
8
+        float inches = ConversionTool.CentimetersToInches(2f);
9
+        assertEquals(0.7874f, inches, 0.001);
10
+    }
11
+    @Test
12
+    public void shouldConvertZeroCentimetersToZeroInches() {
13
+        float inches = ConversionTool.CentimetersToInches(0);
14
+        assertEquals(0, inches, 0.0);
15
+    }
16
+    @Test
17
+    public void shouldConvertNegativeCentimetersToZeroInches() {
18
+        float inches = ConversionTool.CentimetersToInches(-5);
19
+        assertEquals(0, inches, 0.0);
20
+    }
21
+
22
+    @Test
23
+    public void shouldConvertInchesToCentimeters() {
24
+        float centimeters = ConversionTool.InchesToCentimeters(4f);
25
+        assertEquals(10.16f, centimeters, 0.001);
26
+    }
27
+    @Test
28
+    public void shouldConvertZeroInchesToZeroCentimeters() {
29
+        float centimeters = ConversionTool.InchesToCentimeters(0);
30
+        assertEquals(0, centimeters, 0.0);
31
+    }
32
+    @Test
33
+    public void shouldConvertNegativeInchesToZeroCentimeters() {
34
+        float centimeters = ConversionTool.InchesToCentimeters(-5);
35
+        assertEquals(0, centimeters, 0.0);
36
+    }
37
+
38
+    @Test
39
+    public void shouldConvertFeetToMeters() {
40
+        float meters = ConversionTool.FeetToMeters(5f);
41
+        assertEquals(1.524f, meters, 0.001);
42
+    }
43
+    @Test
44
+    public void shouldConvertZeroFeetToZeroMeters() {
45
+        float meters = ConversionTool.FeetToMeters(0);
46
+        assertEquals(0, meters, 0.0);
47
+    }
48
+    @Test
49
+    public void shouldConvertNegativeFeetToZeroMeters() {
50
+        float meters = ConversionTool.FeetToMeters(-10);
51
+        assertEquals(0, meters, 0.0);
52
+    }
53
+
54
+    @Test
55
+    public void shouldConvertMetersToFeet() {
56
+        float feet = ConversionTool.MetersToFeet(9f);
57
+        assertEquals(29.5276f, feet, 0.001);
58
+    }
59
+    @Test
60
+    public void shouldConvertZeroMetersToZeroFeet() {
61
+        float feet = ConversionTool.MetersToFeet(0);
62
+        assertEquals(0, feet, 0.0);
63
+    }
64
+    @Test
65
+    public void shouldConvertNegativeMetersToZeroFeet() {
66
+        float feet = ConversionTool.MetersToFeet(-10);
67
+        assertEquals(0, feet, 0.0);
68
+    }
69
+
70
+    @Test
71
+    public void shouldConvertFahrenheitToCelsius() {
72
+        float celsius = ConversionTool.FahrenheitToCelsius(80);
73
+        assertEquals(26.67, celsius, 0.01);
74
+    }
75
+    @Test
76
+    public void shouldConvertCelsiusToFahrenheit() {
77
+        float fahrenheit = ConversionTool.CelsiusToFahrenheit(26.67f);
78
+        assertEquals(80, fahrenheit, 0.01);
79
+    }
80
+
81
+    @Test
82
+    public void shouldConvertMphToKph(){
83
+        float kph = ConversionTool.MphToKph(24f);
84
+        assertEquals(38.62, kph, 0.01);
85
+    }
86
+    @Test
87
+    public void shouldConvertZeroMphToZeroKph(){
88
+        float kph = ConversionTool.MphToKph(0f);
89
+        assertEquals(0, kph, 0.0);
90
+    }
91
+    @Test
92
+    public void shouldConvertNegativeMphToZeroKph(){
93
+        float kph = ConversionTool.MphToKph(-50f);
94
+        assertEquals(0, kph, 0.0);
95
+    }
96
+
97
+    @Test
98
+    public void shouldConvertKphToMph(){
99
+        float mph = ConversionTool.KphToMph(6.44f);
100
+        assertEquals(4, mph, 0.01);
101
+    }
102
+    @Test
103
+    public void shouldConvertZeroKphToZeroMph(){
104
+        float mph = ConversionTool.KphToMph(0f);
105
+        assertEquals(0, mph, 0.0);
106
+    }
107
+    @Test
108
+    public void shouldConvertNegativeKphToZeroMph(){
109
+        float mph = ConversionTool.KphToMph(-50f);
110
+        assertEquals(0, mph, 0.0);
111
+    }
112
+
113
+}

BIN
target/classes/ConversionTool.class Datei anzeigen


BIN
target/test-classes/ConversionToolSpec.class Datei anzeigen