Dereg { public DeregistrationRequest getDeregRequest(String uafMsg) throws UafRequestMsgParseException { try { logger.info(" [UAF][2]Reg - getDeregRequest : " + uafMsg); return gson.fromJson(uafMsg, DeregistrationRequest[].class)[0]; } catch (Exception e) { throw new UafRequestMsgParseException(e); } }  String dereg(String uafMsg, String appFacetId); DeregistrationRequest getDeregRequest(String uafMsg);  }
@Test public void validRequest() throws UafRequestMsgParseException { Dereg dereg = new Dereg(); String uafMsg = "[{\"header\": {\"op\": \"Dereg\",\"upv\": {\"major\": 1,\"minor\": 0},\"appID\": \"https: DeregistrationRequest deregRequest = dereg.getDeregRequest(uafMsg); assertNotNull(deregRequest); }
@Test public void emtyUafMsg() { Dereg dereg = new Dereg(); String uafMsg = ""; DeregistrationRequest deregRequest = null; try { deregRequest = dereg.getDeregRequest(uafMsg); fail("Should be UafRequestMsgParseException"); } catch (UafRequestMsgParseException e) { assertNull(deregRequest); } }