EngineService { @POST @Path("/systems") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public UserSystem createUserSystem(final String systemName) { if (systemName == null || systemName.equals("")) { throw new InvalidRestParam(); } UserSystem system = new UserSystem(); system.setName(systemName); log.info("created usersystem {} ", systemName); userSystemsRepository.save(system); return system; } @Autowired  EngineService(final UserSystemRepository systemRepository, final CouplingInstanceRepository couplingInstanceRepository); @GET @Produces(MediaType.APPLICATION_JSON) EngineState message(); @GET @Path("/systems") @Produces(MediaType.APPLICATION_JSON) @Transactional UserSystem[] userSystems(); @GET @Path("/systems/{id}") @Produces(MediaType.APPLICATION_JSON) @Transactional UserSystem getSystem(@PathParam("id") final Long id); @POST @Path("/systems") @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) UserSystem createUserSystem(final String systemName); @DELETE @Path("/systems/{id}") @Transactional void deleteUserSystem(@PathParam("id") Long id); @GET @Produces(MediaType.APPLICATION_JSON) @Path("/{id}/couplingdata") @Transactional List<CouplingInstance> getSystemCoupling(@PathParam("id") final Long id);  }
@Test(expected = Exception.class) public void testCreateModelNoName() { service.createUserSystem(""); }