PlanController { @RequestMapping(value = "/plan", method = RequestMethod.POST) public List<Plan> GetPlans(@Validated(Create.class) @RequestBody Plan plan) { return planService.getPlansById(plan.getUserId()); } @Autowired  PlanController(PlanService planService);  PlanController(); void setPlanService(PlanService planService); @RequestMapping(value = "/savePlan", method = RequestMethod.POST) Plan AddPlans(@Validated(Create.class) @RequestBody Plan plan); @RequestMapping(value = "/plan", method = RequestMethod.POST) List<Plan> GetPlans(@Validated(Create.class) @RequestBody Plan plan); @RequestMapping(value = "/deletePlace/{id}", method = RequestMethod.POST) boolean deletePlan(@PathVariable int id, @Validated(Create.class) @RequestBody Plan plan);  }
@Test public void testGetPlans() { when(planService.getPlansById(plan.getUserId())).thenReturn(plans); assertEquals(plans, planController.GetPlans(plan)); }
@Test public void testInvalidGetPlans() { when(planService.getPlansById(plan.getUserId())).thenReturn(plans); when(planService.getPlansById(plan2.getUserId())).thenReturn(plans); assertEquals(planController.GetPlans(plan2), planController.GetPlans(plan)); }