Search in sources :

Example 1 with Given

use of org.jbehave.core.annotations.Given in project javaparser by javaparser.

the class PrettyPrintingSteps method givenTheClassInTheFile.

@Given("the {class|compilation unit|expression|block|statement|import|annotation|body|class body|interface body} in the file \"$classFile\"")
public void givenTheClassInTheFile(String classFile) throws URISyntaxException, IOException, ParseException {
    URL url = getClass().getResource("../samples/" + classFile);
    sourceUnderTest = readerToString(new FileReader(new File(url.toURI()))).trim();
}
Also used : FileReader(java.io.FileReader) File(java.io.File) URL(java.net.URL) Given(org.jbehave.core.annotations.Given)

Example 2 with Given

use of org.jbehave.core.annotations.Given in project jbehave-core by jbehave.

the class OrganizationSteps method createOrganizationWithName.

@Given("an organization named $orgNames")
@Alias("organizations named $orgNames")
public void createOrganizationWithName(List<String> orgNames) {
    for (String orgName : orgNames) {
        Organization org = new Organization();
        org.setName(orgName);
        org.setAuthenticationPolicy(new AuthenticationPolicy());
        organizationDao.persist(org);
    }
}
Also used : Organization(org.jbehave.example.spring.security.domain.Organization) AuthenticationPolicy(org.jbehave.example.spring.security.domain.AuthenticationPolicy) Alias(org.jbehave.core.annotations.Alias) Given(org.jbehave.core.annotations.Given)

Example 3 with Given

use of org.jbehave.core.annotations.Given in project jbehave-core by jbehave.

the class UserSteps method setUserExpired.

@Given("user for $orgName $username is expired")
public void setUserExpired(String orgName, String username) {
    Organization org = organizationDao.findByName(orgName);
    User user = userDao.findUserByOrganizationAndUsername(org.getId(), username);
    user.setExpired(true);
    userDao.persist(user);
}
Also used : Organization(org.jbehave.example.spring.security.domain.Organization) User(org.jbehave.example.spring.security.domain.User) Given(org.jbehave.core.annotations.Given)

Example 4 with Given

use of org.jbehave.core.annotations.Given in project jbehave-core by jbehave.

the class UserSteps method createUsersFromTable.

@Given("the users for $orgName: $userTable")
public void createUsersFromTable(String orgName, ExamplesTable table) {
    Organization org = organizationDao.findByName(orgName);
    List<Parameters> parametersList = table.getRowsAsParameters(true);
    for (Parameters parameters : parametersList) {
        userDao.persist(new UserBuilder(org, parameters, table.getHeaders()).build());
    }
}
Also used : Organization(org.jbehave.example.spring.security.domain.Organization) Parameters(org.jbehave.core.steps.Parameters) UserBuilder(org.jbehave.example.spring.security.domain.UserBuilder) Given(org.jbehave.core.annotations.Given)

Example 5 with Given

use of org.jbehave.core.annotations.Given in project jbehave-core by jbehave.

the class GridSteps method theGameIsRunning.

@Given("a $width by $height game")
@Aliases(values = { "a new game: $width by $height" })
public void theGameIsRunning(int width, int height) {
    game = new Game(width, height);
    renderer = new StringRenderer();
    game.setObserver(renderer);
}
Also used : Game(com.lunivore.gameoflife.domain.Game) StringRenderer(com.lunivore.gameoflife.view.string.StringRenderer) Given(org.jbehave.core.annotations.Given) Aliases(org.jbehave.core.annotations.Aliases)

Aggregations

Given (org.jbehave.core.annotations.Given)12 Organization (org.jbehave.example.spring.security.domain.Organization)8 User (org.jbehave.example.spring.security.domain.User)4 AuthenticationPolicy (org.jbehave.example.spring.security.domain.AuthenticationPolicy)2 Game (com.lunivore.gameoflife.domain.Game)1 StringRenderer (com.lunivore.gameoflife.view.string.StringRenderer)1 File (java.io.File)1 FileReader (java.io.FileReader)1 Method (java.lang.reflect.Method)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Alias (org.jbehave.core.annotations.Alias)1 Aliases (org.jbehave.core.annotations.Aliases)1 Then (org.jbehave.core.annotations.Then)1 When (org.jbehave.core.annotations.When)1 LoadOdtFromGoogle (org.jbehave.core.io.google.LoadOdtFromGoogle)1 Parameters (org.jbehave.core.steps.Parameters)1 AuthenticationPolicyBuilder (org.jbehave.example.spring.security.domain.AuthenticationPolicyBuilder)1 UserBuilder (org.jbehave.example.spring.security.domain.UserBuilder)1