### Question:
DAOProvider { public BAuthorizationDAO getBAuthorizationDAO() { if (DatabaseDriver.fromJdbcUrl(url) == DatabaseDriver.POSTGRESQL) { return new PostgreSQLBAuthorizationDAO(queryService); } throw new NullPointerException(NOT_IMPLEMENTED_YET); } @Autowired  DAOProvider(final QueryService queryService); BAuthorizationDAO getBAuthorizationDAO(); BPermissionDAO getBPermissionDAO();  }### Answer:
@Test public void getBAuthorizationDAOThrowNullPointer() { daoProvider = new DAOProvider(queryService); ReflectionTestUtils.setField(daoProvider, URL, URL_VALUE_UNKNOWN); boolean threwException = false; try { Assert.assertNotNull(daoProvider.getBAuthorizationDAO()); } catch (NullPointerException e) { threwException = true; } if (!threwException) { Assert.fail(URL_VALUE_UNKNOWN_MESSAGE); } }
@Test public void getBAuthorizationDAOOK() { daoProvider = new DAOProvider(queryService); ReflectionTestUtils.setField(daoProvider, URL, URL_VALUE); Assert.assertNotNull(daoProvider.getBAuthorizationDAO()); }