Exemple #1
0
 @Test
 public void construct() {
   Field field = Field.of("foo").with(Json.jString("bar"));
   assertEquals(field.name, "foo");
   assertEquals(field.value, Option.of(Json.jString("bar")));
   assertEquals(field.classes, none());
   assertEquals(field.title, none());
   assertEquals(field.type, Type.TEXT);
 }
 @Test
 public void shouldGetOptionNonEmpty() {
   assertThat(of(1).getOption()).isEqualTo(Option.of(1));
 }
 @Test
 public void shouldConvertToOption() {
   assertThat(empty().toOption()).isSameAs(Option.none());
   assertThat(of(1).toOption()).isEqualTo(Option.of(1));
 }
Exemple #4
0
 @Test
 public void shouldPop2Option() {
   assertThat(empty().pop2Option()).isSameAs(Option.none());
   assertThat(of(1).pop2Option()).isEqualTo(Option.of(Tuple.of(1, empty())));
   assertThat(of(1, 2).pop2Option()).isEqualTo(Option.of(Tuple.of(1, of(2))));
 }
Exemple #5
0
 @Test
 public void shouldPeekOption() {
   assertThat(empty().peekOption()).isSameAs(Option.none());
   assertThat(of(1).peekOption()).isEqualTo(Option.of(1));
   assertThat(of(1, 2).peekOption()).isEqualTo(Option.of(1));
 }
Exemple #6
0
 public Action with(Fields fields) {
   return new Action(name, href, classes, title, method, type, Option.of(fields));
 }
Exemple #7
0
 public Action with(MIMEType type) {
   return new Action(name, href, classes, title, method, Option.of(type), fields);
 }
Exemple #8
0
 public Action with(Method method) {
   return new Action(name, href, classes, title, Option.of(method), type, fields);
 }
Exemple #9
0
 public Action with(String title) {
   return new Action(name, href, classes, Option.of(title), method, type, fields);
 }
Exemple #10
0
 public Action with(Classes classes) {
   return new Action(name, href, Option.of(classes), title, method, type, fields);
 }