File tree Expand file tree Collapse file tree 2 files changed +61
-13
lines changed
main/java/org/javaee7/sample
test/java/org/javaee7/sample Expand file tree Collapse file tree 2 files changed +61
-13
lines changed Original file line number Diff line number Diff line change 99@ RequestScoped
1010@ Path ("persons" )
1111public class Person {
12-
13- @ Inject PersonDatabase database ;
14-
15- @ GET
16- public String get () {
17- return database .currentList ().toString ();
18- }
19-
20- @ GET
21- @ Path ("{id}" )
22- public String get (@ PathParam ("id" )int id ) {
23- return database .getPerson (id );
24- }
12+
13+ @ Inject
14+ PersonDatabase database ;
15+
16+ @ GET
17+ public String get () {
18+ return database .currentList ().toString ();
19+ }
20+
21+ @ GET
22+ @ Path ("{id}" )
23+ public String get (@ PathParam ("id" ) int id ) {
24+ return database .getPerson (id );
25+ }
2526}
Original file line number Diff line number Diff line change 1+ package org .javaee7 .sample ;
2+
3+ import org .junit .After ;
4+ import org .junit .AfterClass ;
5+ import org .junit .Before ;
6+ import org .junit .BeforeClass ;
7+ import org .junit .Test ;
8+ import static org .junit .Assert .*;
9+
10+ /**
11+ * @author arungupta
12+ */
13+ public class PersonTest {
14+
15+ public PersonTest () {
16+ }
17+
18+ /**
19+ * Test of get method, of class Person.
20+ */
21+ @ Test
22+ public void testGetAll () {
23+ System .out .println ("get" );
24+ Person instance = new Person ();
25+ String expResult = "" ;
26+ String result = instance .get ();
27+ assertEquals (expResult , result );
28+ // TODO review the generated test code and remove the default call to fail.
29+ fail ("The test case is a prototype." );
30+ }
31+
32+ /**
33+ * Test of get method, of class Person.
34+ */
35+ @ Test
36+ public void testGetOne () {
37+ System .out .println ("get" );
38+ int id = 0 ;
39+ Person instance = new Person ();
40+ String expResult = "" ;
41+ String result = instance .get (id );
42+ assertEquals (expResult , result );
43+ // TODO review the generated test code and remove the default call to fail.
44+ fail ("The test case is a prototype." );
45+ }
46+
47+ }
You can’t perform that action at this time.
0 commit comments