File tree Expand file tree Collapse file tree
com.vogella.android.temperatureconverter
java/com/vogella/android/temperatureconverter
test/java/com/vogella/android/temperatureconverter Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
22
33android {
44 compileSdkVersion 22
5- buildToolsVersion " 23.0.0 rc2"
5+ buildToolsVersion ' 23.0.0 rc2'
66
77 defaultConfig {
88 applicationId " com.vogella.android.temperatureconverter"
@@ -20,5 +20,6 @@ android {
2020}
2121
2222dependencies {
23- compile fileTree(dir : ' libs' , include : [' *.jar' ])
24- }
23+ compile fileTree(include : [' *.jar' ], dir : ' libs' )
24+ testCompile ' junit:junit:4.12'
25+ }
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ public class MainActivity extends Activity {
1414 public void onCreate (Bundle savedInstanceState ) {
1515 super .onCreate (savedInstanceState );
1616 setContentView (R .layout .activity_main );
17- text = (EditText ) findViewById (R .id .editText1 );
17+ text = (EditText ) findViewById (R .id .inputValue );
1818
1919 }
2020
Original file line number Diff line number Diff line change 1414 <EditText
1515 android : layout_width =" match_parent"
1616 android : layout_height =" wrap_content"
17- android : id =" @+id/editText1" />
17+ android : id =" @+id/inputValue"
18+ android : inputType =" numberSigned|numberDecimal" />
1819
1920 <RadioGroup
2021 android : id =" @+id/radioGroup1"
2829 android : layout_width =" wrap_content"
2930 android : layout_height =" wrap_content"
3031 android : checked =" true"
31- android : text =" RadioButton " />
32+ android : text =" @string/celsius " />
3233
3334 <RadioButton
3435 android : id =" @+id/radio1"
3536 android : layout_width =" wrap_content"
3637 android : layout_height =" wrap_content"
37- android : text =" RadioButton " />
38+ android : text =" @string/fahrenheit " />
3839 </RadioGroup >
3940
4041 <Button
4445 android : layout_alignStart =" @+id/radioGroup1"
4546 android : layout_below =" @+id/radioGroup1"
4647 android : layout_marginTop =" 22dp"
47- android : text =" Button" />
48+ android : text =" @string/calc"
49+ android : onClick =" onClick" />
4850
4951</LinearLayout >
Original file line number Diff line number Diff line change 1+ package com .vogella .android .temperatureconverter ;
2+
3+ import org .junit .runner .RunWith ;
4+ import org .junit .runners .Suite ;
5+ import org .junit .runners .Suite .SuiteClasses ;
6+
7+ @ RunWith (Suite .class )
8+ @ SuiteClasses ({
9+ ConverterTest .class
10+ })
11+
12+ public class AllTests {
13+ }
Original file line number Diff line number Diff line change 1+ package com .vogella .android .temperatureconverter ;
2+
3+ import org .junit .Test ;
4+ import static org .junit .Assert .*;
5+
6+ public class ConverterTest {
7+ @ Test
8+ public void testConvert () {
9+ float actual = ConverterUtil .convertCelsiusToFahrenheit (100 );
10+ float expected = 212 ;
11+ assertEquals ("Conversion from celsius to fahrenheit failed" , expected ,
12+ actual , 0.001 );
13+ }
14+ }
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ buildscript {
55 jcenter()
66 }
77 dependencies {
8- classpath ' com.android.tools.build:gradle:1.2.3 '
8+ classpath ' com.android.tools.build:gradle:1.3.0-beta2 '
99
1010 // NOTE: Do not place your application dependencies here; they belong
1111 // in the individual module build.gradle files
You can’t perform that action at this time.
0 commit comments