Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 569 Bytes

File metadata and controls

35 lines (26 loc) · 569 Bytes

Java Spring Boot tests

Sample

package com.example.demoapi;

import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
import org.junit.jupiter.api.Test;

class DemoApiApplicationTests {

	Calculator underTest = new Calculator();

	@Test
	void itShouldAddTwoNumbers() {
		// given
		int numberOne = 20;
		int numberTwo = 30;

		// when
		int result = underTest.add(numberOne, numberTwo);

		// then
		int expected = 50;
		assertThat(result).isEqualTo(expected);
	}

	class Calculator {
		int add(int a, int b) {
			return a + b;
		}
	}
}