@Test public Oscar testConstructor()
throws URISyntaxException
{
Oscar oscar = new Oscar();
Assert.assertNotNull(oscar);
return oscar;
}
@Given("#testConstructor")
public String testNormalize(Oscar oscar)
throws URISyntaxException
{
String input = oscar.normalize(
"This is a simple input string with benzene."
);
Assert.assertNotNull(input);
return input;
}
@Given("#testConstructor,#testNormalize")
public List testTokenize(
Oscar oscar, String input) throws Exception
{
List tokens = oscar.tokenize(input);
Assert.assertNotNull(tokens);
Assert.assertNotSame(0, tokens.size());
return tokens;
}
@Given("#testConstructor,#testTokenize")
public List testRecognizeNamedEntities(
Oscar oscar, List tokens)
throws Exception
{
List entities =
oscar.recognizeNamedEntities(tokens);
Assert.assertNotNull(entities);
Assert.assertEquals(1, entities.size());
return entities;
}
The pattern here is that each test method returns one variable, so that any method depending on two other unit test will have two parameters. The order is defined by the order in which they are given by the @Given clause.
No comments:
Post a Comment