use of javax.json.JsonObject in project visualee by Thomas-S-B.
the class GraphCreatorTest method testBuildJSONNode.
@Test
public void testBuildJSONNode() {
JavaSourceContainer.getInstance().clear();
DependencyContainer.getInstance().clear();
String name = "MyTestClass";
String sourcecode = "test source code - Matt Pavolka Group - Something People Can Use";
JavaSource javaSource = JavaSourceFactory.getInstance().newJavaSource("MyTestClass");
javaSource.setGroup(2);
javaSource.setPackagePath("de.test.test2");
javaSource.setSourceCode(sourcecode);
JsonObjectBuilder job = GraphCreator.buildJSONNode(javaSource);
JsonObject node = job.build();
assertEquals(name, node.getString("name"));
assertEquals(2, node.getInt("group"));
assertNotNull(node.getString("description"));
assertEquals(sourcecode, node.getString("sourcecode"));
}
use of javax.json.JsonObject in project javaee7-samples by javaee-samples.
the class NameAddResourceTest method shouldFailAtFirstNameNullValidation.
@Test
public void shouldFailAtFirstNameNullValidation() throws Exception {
JsonObject name = startValidName().addNull("firstName").build();
Response response = postName(name);
assertFailedValidation(response);
}
use of javax.json.JsonObject in project javaee7-samples by javaee-samples.
the class NameAddResourceTest method shouldFailAtEmailComDomainValidation.
@Test
public void shouldFailAtEmailComDomainValidation() throws Exception {
JsonObject name = startValidName().add("email", "other-than-com@domain.pl").build();
Response response = postName(name);
assertFailedValidation(response);
}
use of javax.json.JsonObject in project javaee7-samples by javaee-samples.
the class NameAddResourceTest method shouldFailAtLastNameSizeValidation.
@Test
public void shouldFailAtLastNameSizeValidation() throws Exception {
JsonObject name = startValidName().add("lastName", "").build();
Response response = postName(name);
assertFailedValidation(response);
}
use of javax.json.JsonObject in project javaee7-samples by javaee-samples.
the class NameAddResourceTest method shouldFailAtFirstNameSizeValidation.
@Test
public void shouldFailAtFirstNameSizeValidation() throws Exception {
JsonObject name = startValidName().add("firstName", "").build();
Response response = postName(name);
assertFailedValidation(response);
}
Aggregations