-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
return optional ofNullable, as the boundary condition may be undefine…
…d during initialization.
- Loading branch information
1 parent
8f0b970
commit 611afab
Showing
2 changed files
with
34 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package main.mesh; | ||
|
||
import org.junit.Test; | ||
|
||
import java.util.List; | ||
import java.util.Optional; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
public class BoundaryTest { | ||
|
||
@Test | ||
public void constructor_nullability_test() { | ||
// null name | ||
assertThrows(NullPointerException.class, () -> new Boundary(null, List.of(), null)); | ||
// null faces | ||
assertThrows(NullPointerException.class, () -> new Boundary("name", null, null)); | ||
} | ||
|
||
@Test | ||
public void bc_optionality_test() { | ||
Boundary bnd = new Boundary("bnd name", List.of(), null); | ||
assertEquals(Optional.empty(), bnd.bc()); | ||
} | ||
|
||
@Test | ||
public void trying_to_set_null_bc() { | ||
Boundary bnd = new Boundary("bnd name", List.of(), null); | ||
assertThrows(NullPointerException.class, () -> bnd.setBC(null)); | ||
} | ||
} |