SystemSettingDaoImpl implements SystemSettingDao { @Override public Response write(SystemSetting systemSetting) { Map<String, Object> map = mapper.convertValue(systemSetting, Map.class); Response response = cassandraOperation.upsertRecord(KEYSPACE_NAME, TABLE_NAME, map); response.put(JsonKey.ID, map.get(JsonKey.ID)); return response; } SystemSettingDaoImpl(CassandraOperation cassandraOperation); @Override Response write(SystemSetting systemSetting); @Override SystemSetting readById(String id); @Override SystemSetting readByField(String field); List<SystemSetting> readAll();  }
@Test public void testSetSystemSettingSuccess() { PowerMockito.when( cassandraOperation.upsertRecord( Mockito.anyString(), Mockito.anyString(), Mockito.anyMap())) .thenReturn(new Response()); boolean thrown = false; try { SystemSetting systemSetting = new SystemSetting(ROOT_ORG_ID, FIELD, VALUE); Response upsertResp = systemSettingDaoImpl.write(systemSetting); Assert.assertNotEquals(null, upsertResp); } catch (Exception e) { thrown = true; } Assert.assertEquals(false, thrown); }