Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for duration and dtend properties
- Loading branch information
1 parent
1a80f30
commit aae2982
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/test/java/tr/edu/itu/cavabunga/lib/entity/property/DtendTest.java
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,36 @@ | ||
package tr.edu.itu.cavabunga.lib.entity.property; | ||
|
||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.platform.runner.JUnitPlatform; | ||
import org.junit.runner.RunWith; | ||
import tr.edu.itu.cavabunga.lib.exception.Validation; | ||
|
||
import java.util.stream.Stream; | ||
|
||
import static org.mockito.Mockito.doThrow; | ||
import static org.mockito.Mockito.mock; | ||
|
||
@RunWith(JUnitPlatform.class) | ||
class DtendTest extends PropertyTest { | ||
|
||
private static Stream invalidInputProvider() { | ||
// TODO: 10/2/2018 test with non-mock object | ||
Dtend dtend1 = mock(Dtend.class); | ||
doThrow(Validation.class).when(dtend1).validate(); | ||
return Stream.of( | ||
Arguments.of( | ||
dtend1 | ||
) | ||
); | ||
} | ||
|
||
private static Stream validInputProvider() { | ||
Dtend dtend1 = new Dtend(); | ||
dtend1.setValue("20100212T235900"); | ||
return Stream.of( | ||
Arguments.of( | ||
dtend1 | ||
) | ||
); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/test/java/tr/edu/itu/cavabunga/lib/entity/property/DurationTest.java
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,36 @@ | ||
package tr.edu.itu.cavabunga.lib.entity.property; | ||
|
||
import org.junit.jupiter.params.provider.Arguments; | ||
import org.junit.platform.runner.JUnitPlatform; | ||
import org.junit.runner.RunWith; | ||
import tr.edu.itu.cavabunga.lib.exception.Validation; | ||
|
||
import java.util.stream.Stream; | ||
|
||
import static org.mockito.Mockito.doThrow; | ||
import static org.mockito.Mockito.mock; | ||
|
||
@RunWith(JUnitPlatform.class) | ||
class DurationTest extends PropertyTest { | ||
|
||
private static Stream invalidInputProvider() { | ||
// TODO: 10/2/2018 test with non-mock object | ||
Duration duration1 = mock(Duration.class); | ||
doThrow(Validation.class).when(duration1).validate(); | ||
return Stream.of( | ||
Arguments.of( | ||
duration1 | ||
) | ||
); | ||
} | ||
|
||
private static Stream validInputProvider() { | ||
Duration duration1 = new Duration(); | ||
duration1.setValue("P15DT5H0M20S"); | ||
return Stream.of( | ||
Arguments.of( | ||
duration1 | ||
) | ||
); | ||
} | ||
} |