An example of a web controller is ____
1.Apache Struts Framework
2. JUnit
3.Java
4.Php
If we want to run test files Test1 and Test2 together, the @SuiteClasses annotation will be?
1. @SuiteClasses(value={Test1.class,Test2.class})
2. @SuiteClasses(value=All)
3.@SuiteClasses(Test1, Test2);
4.@SuiteClasses()
Improving the design of existing code is known as _______
1.Refactoring
2. Improving
3. Betterment
4.Upgrading
In the context of unit testing, the term ___________ is used to contrast and compare the objects you use in your application with the objects that you use to test your application (test objects).
1.Mock Object
2.Dummy Object
3.Domain Object
4. Real Object
Inversion of Control is used to increase __________ of the code.
1.Functionality
2.Cleanliness
3. Effectiveness
4.Modularity
JUnit test files are written in files with which file extension?
1..junit
2..test
3. .java
4. .unit
JUnit test methods must compulsorily return what value?
1.String
2.int
3.Object
4.void
Suite class is the JUnit 4 equivalent of what feature of JUnit 3.8.x?
1.static Test suite() method
2. Test suite() method
3. static void suite() method
4. void suite() method
The ______ is a component that “interacts with a client, controlling and managing the handling of each requestâ€.
1.Master
2.RequestHandler
3.Controller
4.Class
The ______ method confirms that both references are to the same object.
1.assertEquals
2.assertEqual
3.assertEqualObject
4.assertSame
The _________ is a sequential or non-iterative design process, which is used in software development processes, in which progress is seen as flowing steadily downwards.
1.Waterfall Model
2.Iterative Model
3.Spiral Model
4. Big Bang Model
What happens if the tester does not define a Suite?
1.The test runner automatically creates a Suite
2. Compilation Error
3. Every test fails
4.Every test passes
Which method from TestCase class returns the name of a Test case?
1.String testCaseName()
2.String getTest()
3.String getTestCaseName()
4. String getName()
Will the second and third assert failures be reported? public class TestFile { @Test public void testMethod() { assertTrue(false); assertTrue(false); assertTrue(false); } }
1.Yes
2.No
3.none
4.all the mentoined
A JUnit Unit Test Case is compulsorily characterised by a/an known _______ and a/an expected _____
1.output, input
2. input, output
3. variable, literal
4.program, variable
A parameterised test class must carry which annotation?
1.@Test
2.@ParameterisedClass
3.@Runwith
4.@Class
Constructor-based DI is accomplished when the container invokes a class constructor with ______
1.A number of arguments
2.No argument
3. Just one argument
4.Null objects
Constructor-based DI is preferred for ______
1.Optional dependencies
2.Mandatory dependencies
3.All dependencies
4.No dependency
Controller logic component accesses the ________ logic component.
1. Class
2.Object
3.Business
4. Criteria
For a Suite class, the @RunWith annotation has the value of which class?
1.org.junit.runners.class
2.org.junit.Suite.class
3. org.runners.Suite.class
4. org.junit.runners.Suite.class
How can a method be made to run before the execution of every test case?
1.Annotate the method with @Before
2. Prefix the method name with startfirst
3.Annotate the method with a @BeforeClass
4.Such a method cannot be made
In what order is multiple @Before annotated methods run?
1.Oldest First
2.Newest First
3.Randomly
4.According to argument list
JUnit is used for what type of software testing for the Java language?
1.Unit Testing
2. Integration Testing
3. Functional Testing
4.System Testing
JUnit Suites are independent of the capability of the ______ system.
1.Run
2.Class
3.Test
4.Build
Overuse of argument _________ can lead to fragile tests.
1.Parameters
2. Objects
3.Classes
4.Captors
The assertEquals() method uses which underlying method to compare objects?
1.==
2.equals()
3.isequal()
4. =
The equals() method is inherited from which base class?
1.Object
2.String
3.Integer
4.org.junit.Equals
The principle of “Hollywood Principle: Don’t call us, we’ll call you†is commonly known as ______
1.Calling Principle
2.Control Call
3.Inversion of Control
4.No-Show Principle
The Suite object is a _____ that executes all of the @Test annotated methods in the test class.
1.Result
2.FolderConfigurationTest
3.FileConfigurationTest
4. Runner
The test class must carry the @RunWith annotation with the ______ class as its argument.
1.Default
2. Parameterised
3.Super
4.Inherited
The ______ is a container used to gather tests for the purpose of grouping and invocation.
1. Result
2. TestCase
3.Suite
4.Test
To avoid overdesigning an interface, usually ____________ is used.
1.Agile Development
2.Test Driven Development
3.Base Design Development
4.Waterfall Development
To use JUnit in a project we need to add which JAR files on our test classpath?
1.junit.jar
2.hamcrest-core.jar
3.junit.jar and hamcrest-core.jar
4.java-junit.jar
To use Parameterized.class with the @RunWith annotation, we need to import ____
1.org.junit.runners.Parameterized
2.org.junit.Parameterized
3.org.junit.runners.Parameterized
4. org.runners.Parameterized
What are fixtures in JUnit?
1.Objects that specify when to run a test
2.Fixed state of a set of objects used as a baseline for running tests
3.Bundle of few test cases run together
4.Date objects
What are Parameterised tests used for in JUnit?
1.Run a test many times with different sets of parameters
2.Run a test with no parameters
3.Run a test with only String parameters
4.Run a test once with fixed set of parameters
What are the object(s) which make the core of the description of a controller component?
1. The Request, the Response
2.The Request, the Response, the RequestHandler, and the Controller
3. The Request
4. The RequestHandler
What does the assertTrue(“messageâ€,A) do?
1.Asserts that the condition A is true
2.Asserts that “message†= A
3.Asserts that A contains “messageâ€
4. Asserts that the condition A is false
What does the fail() method do in JUnit?
1.Throws an assertion error unconditionally
2.Calls the default constructor
3. Outputs the message “Fail†to the console
4. Pauses the test for 1 second
What is a test runner?
1.Used to execute the test file
2.Defines the test file
3. Used to write test cases
4.Used to define annotations
What is the purpose of assertArrayEquals(“messageâ€, A, B)?
1.Checks that “message†is in both A and B
2.Checks that “message†is in A but not B
3.Checks that “message†is in B but not A
4.Asserts the equality of the A and B arrays
What is the signature of the addHandler method of the Controller interface?
1.void addHandler(Request request, RequestHandler requestHandler)
2.void addHandler(RequestHandler requestHandler);
3. void addHandler(RequestHandler requestHandler);
4.void addHandler(Request request, Request requestHandler);
What will be the outcome for the following piece of code? //The JUnit files are imported public class TestClass { @Test public void testingMethod() { String message = “Testâ€; assertEquals(3,message.length()); } }
1.Compilation Error
2.Runtime Error
3.Test Ran with Success
4. Test Ran with Failure
When is the tearDown() method called in JUnit?
1. After all the tests have run
2.At the beginning of every test case
3. After each test case has run
4.At the beginning of the first test case
When the container calls setter methods after invoking a constructor with no arguments it is known as _______
1. Constructor-based dependency injection
2.Setter-based dependency injection
3.Setter-Seller dependency injection
4.No-Constructor dependency injection
Which annotation implies that a method is a JUnit test case?
1. @junit
2. @testcase
3.@org.Test
4.@org.junit.Test
Which annotation is used to list all the classes in a suite?
1.@RunWith
2. @SuiteClasses
3. @Classses
4. @SuiteClass
Which annotation must be used to define suite classes?
1. @RunWith
2.@SuiteClasses
3.@Suite
4.@SuiteClass
Which attribute is added to the @Test annotation so that the test passes when an expected exception is thrown?
1.exception
2.throws
3.expected
4.expectedException
Which methods cannot be tested by JUnit test class?
1. public methods
2.private methods
3. protected methods
4.methods with void return type