@Test(expected = MissingFormatArgumentException.class) public void createAggregatorNotAdminTest() throws Exception { when(userManager.isAdmin()).thenReturn(false); Aggregator aggregator = new Aggregator(); aggregator.setAggregatorId("*****@*****.**"); aggregator.setAggregatorName("aggregatorName"); toTest.createAggregator(aggregator); fail(); }
@Test public void createAggregatorTest() throws Exception { when(userManager.isAdmin()).thenReturn(true); Aggregator aggregator = new Aggregator(); aggregator.setAggregatorId("*****@*****.**"); aggregator.setAggregatorName("aggregatorName"); Response response = toTest.createAggregator(aggregator); Assert.assertEquals(201, response.getStatus()); }