JUnit 없이 직접 단위 테스트 작성

public class StampCalculator {
    public static int calculateStampCount(int nowCount, int earned) {
        return nowCount + earned;
    }

}
public class StampCalculatorTestWithoutJUnit {
    public static void main(String[] args) {
        calculateTest();
    }

    private static void calculateTest() {
        //given
        int nowCount = 5;
        int earned = 3;

        //when
        int actual = StampCalculator.calculateStampCount(nowCount, earned);

        int expected = 7;

        System.out.println(actual == expected);
    }
}

JUnit으로 테스트 작성하기

package com.codestates;

import java.util.HashMap;
import java.util.Map;

public class CryptoCurrency {

    public static Map<String, String> map = new HashMap<>();

    static {
        map.put("BTC", "Bitcoin");
        map.put("ETH", "Ethereum");
        map.put("ADA", "ADA");
        map.put("POT", "Polkadot");
    }
}