×
固定報酬制
|
5,000円 〜 10,000円
|
---|---|
納品完了日
|
2019年12月10日 |
掲載日
|
2019年12月09日 |
応募期限
|
2019年12月10日 |
応募した人 | 2 人 |
---|---|
契約した人 | 1 人 |
募集人数 | 1 人 |
気になる!リスト | 9 人 |
java.util.Optionalの ・get() ・isPresent() ・map() ・filter() のテストコードを作成してください。 テストはAPIドキュメントを考慮し作成していただきますようお願いします。 ```サンプル import static org.hamcrest.CoreMatchers.*; import static org.junit.Assert.*; import java.util.Optional; import org.junit.Test; public class Test { @SuppressWarnings("deprecation") @Test public void ofをテスト() { Optional<Integer> a = Optional.of(3); int expected = 3; int actual = a.get(); assertThat(actual,is(expected)); } @SuppressWarnings("deprecation") @Test public void getをテスト() { int a = 3; Optional<Integer> expected = Optional.of(3); Optional<Integer> actual = Optional.of(a); assertThat(actual,is(expected)); } @SuppressWarnings("deprecation") @Test public void isPesentの値ありをテスト() { Optional<Integer> actual = Optional.of(3); assertThat(actual.isPresent(), is(true)); } @SuppressWarnings("deprecation") @Test public void isPesentの値なしをテスト() { Optional<Integer> a = Optional.of(3); Optional<Integer> actual = a.filter(y -> y % 5 == 0); assertThat(actual.isPresent(), is(false)); } @SuppressWarnings("deprecation") @Test public void mapをテスト() { Optional<Integer> a = Optional.of(3); Optional<Integer> actual = a.map(x -> x * x); // 二乗してから Optional で包み直す Optional<Integer> expected = Optional.of(9); assertThat(actual, is(expected)); } @SuppressWarnings("deprecation") @Test public void filterのtureパターンをテスト() { Optional<Integer> a = Optional.of(3); Optional<Integer> actual = a.filter(y -> y % 3 == 0); assertThat(actual.isPresent(), is(true)); } @SuppressWarnings("deprecation") @Test public void filterのfalseパターンをテスト() { Optional<Integer> a = Optional.of(4); Optional<Integer> actual = a.filter(y -> y % 3 == 0); assertThat(actual.isPresent(), is(false)); } } ``` コメントでメソッドに対してどういった考慮をしてテストメソッドを作ったのかのコメントも必ず書き込んでください。 JAVAは `jdk-11.0.5.jdk`を使用 JUnitは `junit-4.13-rc-2.jar`を使用 hamcrestは`hamcrest-2.2.jar`を使用 急で申し訳ありませんが2019/12/10までに納品をお願いします。 報酬は1蔓延を予定しております。 普段から業務でJUnitを使われている方なら1時間程度の作業と想定しております。 もし、私の認識不足で1時間程度の作業で収まらない場合はご連絡いただければ金額を変更いたします。 一定の経験があれば、先着で依頼したいと思います。 よろしくお願いいたします。 |
特記事項 |
---|
|
クラウドワーカー | 応募日時 |
---|---|
lard4c | 2019/12/09 17:39 |
satoshi99999 | 2019/12/09 17:25 |