Oracle Java Interview Questions & Answers Set-12

«« Previous
Next »»

221) What is Pub/Sub model?
Ans: In Publisher/Subscriber model, one message is delivered to all subscribers. Here, Topic is used as a message oriented middleware.

222) What is MDB?
Ans: Message Driven Bean (MDB) encapsulates business logic. It is invoked by passing message. It is like JMS receiver.

223) What is Entity Bean?
Ans: Entity Bean is a server side component that represents the persistent data. Since EJB 3.x, it is replaced by JPA.

224) What is Session Facade?
Ans: Session Facade is a design pattern to access enterprise bean through local interface. It abstracts the business object interactions and provides a service layer. It makes the performance fast over network.

JUnit Interview Question

225) What is Testing?
Ans: Testing is the process of checking the functionality of the application whether it fulfills the requirement or not.

226) What is JUnit?
Ans: JUnit is the testing framework, it is used for unit testing of java code.

JUnit = Java + Unit Testing

227) What is unit testing?
Ans: The process of testing individual functionality (known as unit) of the application is called unit testing.

228) What is the difference between manual testing and automated testing?
Ans: Manual testing is performed by human so it is time consuming and costly. Automated testing is performed by testing tools or programs so it is fast and less costly.

229) It is necessary to write the test case for every logic?
Ans: No, we should write the test case only for those logic that can be reasonably broken.

230) What are the useful JUnit extensions?
  • JWebUnit
  • XMLUnit
  • Cactus
  • MockObject

231) What are the features of JUnit?
  • Opensource
  • Annotation support for test cases
  • Assertion support for checking the expected result
  • Test runner support to execute the test case

232) What is Unit Test Case?
Ans: A Unit Test Case is the combination of input data and expected output result. It is defined to test the functionality of an unit.

233) What is the use of @Test annotation?
Ans: The @Test annotation is used to mark the method as test method.

234) What is test suit?
Ans: The test suit allows us to group multiple test cases so that it can be run together. TestSuit is the container class under junit.framework.TestSuite package.

235) What does test runner?
Ans: The test runner is used to execute the test cases.

236) What are the important JUnit annotations?
Ans: The test runner is used to execute the test cases.
  • @Test
  • @BeforeClass
  • @Before
  • @After
  • @AfterClass

237) What does Assert class?
Ans: Assert class provides methods to test the test cases.

238) What is JWebUnit?
Ans: WebUnit is a Java-based testing framework for web applications. It wraps existing testing frameworks such as HtmlUnit and Selenium with a unified, simple testing interface to allow you to quickly test the correctness of your web applications.

239) Can you use a main() Method for Unit Testing?
Ans: Yes you can test using main() method. One obvious advantage seems to be that you can whitebox test the class. That is, you can test the internals of it (private methods for example). You can't do that with unit-tests. But primarily the test framework tests the interface and the behavior from the user's perspective.

240) What are Parameterized tests?
Ans: Junit 4 has introduced a new feature Parameterized tests.Parameterized tests allow developer to run the same test over and over again using different values.

«« Previous
Next »»