Aaaaa988

Tests

Dec 10th, 2020 (edited)
511
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.example.nulllab;
  2.  
  3. import junit.framework.TestCase;
  4.  
  5. import org.junit.Test;
  6.  
  7.  
  8. public class MainActivityTest extends TestCase {
  9.     MainActivity mainActivity = new MainActivity();
  10.     @Test
  11.     public void testMin() {
  12.         int a = 3;
  13.         int b = 7;
  14.  
  15.         assertEquals(3, mainActivity.min(a,b));
  16.     }
  17.  
  18.     @Test
  19.     public void testMin2() {
  20.         int a = -3;
  21.         int b = 5;
  22.  
  23.         assertEquals(-3, mainActivity.min(a,b));
  24.     }
  25.  
  26.     @Test
  27.     public void testMax() {
  28.         int a = 3;
  29.         int b = 5;
  30.  
  31.         assertEquals(5, mainActivity.max(a,b));
  32.     }
  33.  
  34.     @Test
  35.     public void testMax2() {
  36.         int a = -10;
  37.         int b = 7;
  38.  
  39.         assertEquals(7, mainActivity.max(a,b));
  40.     }
  41. }
  42.  
  43. ////////////////////////////
  44.  
  45. package com.example.nulllab;
  46.  
  47. import androidx.appcompat.app.AppCompatActivity;
  48.  
  49. import android.os.Bundle;
  50.  
  51. public class MainActivity extends AppCompatActivity {
  52.  
  53.     @Override
  54.     protected void onCreate(Bundle savedInstanceState) {
  55.         super.onCreate(savedInstanceState);
  56.         setContentView(R.layout.activity_main);
  57.     }
  58.  
  59.     public int min(int a, int b){
  60.         return Math.min(a, b);
  61.     }
  62.  
  63.     public int max(int a, int b){
  64.         return Math.max(a, b);
  65.     }
  66.  
  67. }
RAW Paste Data