Junit5 (latest two commits) (#825)

* PDF to X

* PDF to X

* Remove created doc

* Code fixes and cleanup for PDF module

* Fix web.xml in spring-mvc-web-vs-initializer project

* Rollback web.xml

* Fixes to PDF article

* Merge with main eugen branch

* Junit 5

* Fix name of test and modifier
This commit is contained in:
maibin
2016-11-14 09:45:01 +01:00
committed by Grzegorz Piwowarek
parent aeb8f7595c
commit 2d34971fcc
24 changed files with 914 additions and 97 deletions
@@ -1,18 +1,26 @@
package com.baeldung;
import org.junit.gen5.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.expectThrows;
import static org.junit.gen5.api.Assertions.assertEquals;
import static org.junit.gen5.api.Assertions.expectThrows;
import org.junit.jupiter.api.Test;
public class ExceptionTest {
@Test
void shouldThrowException() {
Throwable exception = expectThrows(UnsupportedOperationException.class,
() -> {
throw new UnsupportedOperationException("Not supported");
});
assertEquals(exception.getMessage(), "Not supported");
}
@Test
void shouldThrowException() {
Throwable exception = expectThrows(UnsupportedOperationException.class, () -> {
throw new UnsupportedOperationException("Not supported");
});
assertEquals(exception.getMessage(), "Not supported");
}
@Test
void assertThrowsException() {
String str = null;
assertThrows(IllegalArgumentException.class, () -> {
Integer.valueOf(str);
});
}
}