junit3 Questions

5

Solved

In my test case, I get an integer value: int val = getXXX(); Then, I would like to check if val either equals to 3 or equals to 5 which is OK in either case. So, I did: assertTrue(val == 3 || v...
Orchidaceous asked 25/9, 2013 at 12:14

17

Solved

I am trying to build a simple Java project with Maven. In my pom-file I declare JUnit 4.8.2 as the only dependency. Still Maven insists on using JUnit version 3.8.1. How do I fix it? The problem m...
Widescreen asked 1/5, 2011 at 2:25

6

Solved

When i run the below code, both test cases come true: import static junit.framework.Assert.assertEquals; import org.junit.Test; public class MyTest{ private int count; @Before public void be...
Choli asked 15/10, 2013 at 12:33

3

Solved

I am developing software that loads information from XML files using Android's implementation of java.xml.parsers.DocumentBuilder and DocumentBuilderFactory. I am writing unit tests of my objects a...
Midas asked 27/3, 2012 at 22:28

3

My MainActivity on my Android application checks if the user is logged in (this is stored in SharedPreferences) and if it's not takes the user to the LoginActivity. I am trying to test this using t...
Adhesion asked 22/4, 2014 at 2:32

1

Solved

I'm working on MMU project and I don't know how to fix this error on @Test annotation. How I can fix it? I have added JUnit library but that's not working.
Nata asked 26/6, 2018 at 15:26

5

Solved

Edit: Not JUnit 4 available at this time. Hi there, I have a question about "smart" exception testing with JUnit. At this time, I do it like this: public void testGet() { SoundFileManager sfm...
Benioff asked 21/6, 2010 at 8:46

1

Solved

I need to test a single activity in my Android app. The documentation of ActivityInstrumentationTestCase2 says: This class provides functional testing of a single activity. And the documentati...
Denouement asked 10/5, 2016 at 13:51

2

Solved

This code uses Spring 3.1 and junit4 and spring-test 3.1. I want to turn this code using and loading junit3.8.x. This is due to a legacy build system. How can I do this? Most of the online document...
Gaffrigged asked 30/11, 2015 at 14:53

6

Solved

I know this is bad practice, but it needs to be done, or I'll need to switch to testng. Is there a way, similar to JUnit 3's testSuite, to specify the order of the tests to be run in a class?
Catechize asked 21/6, 2010 at 23:18

6

I would like to write a test for IndexOutOfBoundsException. Keep in mind that we are supposed to use JUnit 3. My code: public boolean ajouter(int indice, T element) { if (indice < 0 || indice...
Knotting asked 6/11, 2012 at 13:56

3

Solved

I have a function that looks like this: private Timer timer = new Timer(); private void doSomething() { timer.schedule(new TimerTask() { public void run() { doSomethingElse(); } }, (1000));...
Anniceannie asked 3/11, 2013 at 4:49

1

Solved

I want to add a JUnit 4 test to a legacy project which uses JUnit 3 test suites ("AllTests") to organize the tests. The tests are already executed with JUnit 4, so I know that JUnit 4 tests work i...
Excretory asked 25/10, 2013 at 13:51

1

<project name="JunitSuite" basedir="." default="clean"> <property name="${src}" value="./src/JunitSuiteProject" /> <property name="${build}" value="./build" /> <property na...
Siloum asked 19/9, 2013 at 6:9

1

I have created a simple program that wil create the dat file through buffered writer and will write some data into that file , now please advise what junit test cases I can have through which I can...
Saxecoburggotha asked 23/8, 2013 at 7:26

1

Solved

Hi I'm new to Spring and to Junit as well. I have a method in my controller. I want to write Junit for this method (getPersons()). @Autowired private PersonService personService; @RequestMapping...
Arguello asked 20/6, 2013 at 8:34

1

I am trying to migrate from Ant build to Gradle in my project. There are a bunch of test cases (subclasses of junit.framework.TestCase) and few test suites (subclasses of junit.framework.TestSuite)...
Pisgah asked 7/3, 2012 at 18:14

2

Solved

as the documentation of Android says, "Note that the Android testing API supports JUnit 3 code style, but not JUnit 4." (Testing Fundamentals). It should be clear that JUnit 4 cannot be used out of...
Butler asked 21/3, 2012 at 16:51

1

I am trying to write Junit test case for the function given below: class A{ int i; void set() { Scanner in=new Scanner(System.in); i=in.nextInt(); } } Now my problem is when i create a Jun...
Russi asked 3/11, 2012 at 19:16

2

Solved

I'm wondering about a nice way to deal with a protected method in Junit. Assuming I want to test a class called A which has a protected member and constructor. I understood that in order to test...
Elijaheliminate asked 11/10, 2012 at 23:58

4

Solved

I'm having some problems when defining inner classes in a Test class inherited from TestCase, for JUnit 3. Scenario is like following: Foo.java public class Foo { public void method() { ... } } ...
Erme asked 11/11, 2010 at 0:40

4

I want to back up my application's database before replacing it with the test fixture. I'm forced to use Junit3 because of Android limitations, and I want to implement the equivalent behavior of @B...
Steer asked 26/8, 2011 at 17:44

1

Solved

Could someone describe in a few words what the main differences between JUnit 3 and 4 are?
Telemetry asked 13/7, 2011 at 21:11

1

Solved

I'm attempting to run a simple JUnit test case on version 3.7 of JUnit (I'm not able to upgrade this to the latest version) Running IntelliJ, I get the following exception when I attempt to run my...
Omphalos asked 8/3, 2011 at 11:10

1

Solved

I'm running JUnit via Ant using a target something like this: <target name="junit" depends="compile"> <mkdir dir="${report.dir}"/> <junit printsummary="yes" haltonfailure="yes" sh...
Shumpert asked 27/10, 2010 at 23:29

© 2022 - 2024 — McMap. All rights reserved.