# language: ru : : * 15 * "" * hello
@(" {int}") public void giveInt(Integer int1) { System.out.println(int1); } @(" {string}") public void giveString(String string) { System.out.println(string); } @(" {word}") public void giveWord(String string) { System.out.println(string); }
# language: ru : : * 01.06.2018
@(" {localdate}") public void ___(LocalDate localdate) { System.out.println(localdate.format(DateTimeFormatter.ofPattern("dd-MM-yyyy"))); }
public class TypeRegistryConfiguration implements TypeRegistryConfigurer { @Override public Locale locale() { // float double return new Locale("ru"); } @Override public void configureTypeRegistry(TypeRegistry typeRegistry) { // typeRegistry.defineParameterType(new ParameterType<>( // , : "localdate", // , : "[0-9]{2}.[0-9]{2}.[0-9]{4}", // : LocalDate.class, // , (Transformer<LocalDate>) s -> { DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy"); return LocalDate.parse(s, formatter); } )); } }
@("Hello, world(s)!") public void getHello() { System.out.println("Hello world!"); }
@("/ ") public void getAlternative() { System.out.println("Hello world!"); }
# language: ru : : * *
# language: ru : DataTable : | | | 09.02.1887 | | | | 23.02.1890 |
import java.time.LocalDate; public class User { private String firstName; private String lastName; private LocalDate birthDay; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public LocalDate getBirthDay() { return birthDay; } public void setBirthDay(LocalDate birthDay) { this.birthDay = birthDay; } @Override public String toString() { return "User{" + "firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", birthDay=" + birthDay + '}'; } }
@(" ") public void ___(List<User> users) { System.out.println(users); }
public class TypeRegistryConfiguration implements TypeRegistryConfigurer { @Override public Locale locale() { return new Locale("ru"); } @Override public void configureTypeRegistry(TypeRegistry typeRegistry) { // DataTableType typeRegistry.defineDataTableType(new DataTableType( User.class, (TableRowTransformer<User>) list -> { User user = new User(); user.setFirstName(list.get(0)); user.setLastName(list.get(1)); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd.MM.yyyy"); user.setBirthDay(LocalDate.parse(list.get(2), formatter)); return user; } )); } }
# language: ru : @hooks : , @only_scenario_hooks : @only_step_hooks :
// not // hooks only_scenario_hooks @Before(value = "(@hooks or @only_scenario_hooks) and not @only_step_hooks") public void before() { System.out.println("before scenario"); } // only_step_hooks @BeforeStep(value = "@only_step_hooks") public void beforeStep() { System.out.println("before step"); } // only_step_hooks @AfterStep(value = "not(@hooks or @only_scenario_hooks) and @only_step_hooks") public void afterStep() { System.out.println("after step"); } // hooks only_scenario_hooks @After(value = "@hooks or @only_scenario_hooks") public void after() { System.out.println("after scenario"); }
# language: ru : : * "" * hello
@(" {string}") public void giveString(String string) { System.out.println(string); } @(" {word}") public void giveWord(String string) { System.out.println(string); }
Source: https://habr.com/ru/post/422651/
All Articles