Unit testing is a method by which individual units of source code are tested to determine if they are fit for use.

learn more… | top users | synonyms

1
vote
1answer
25 views

Proper way of a testable method with multiple return points [on hold]

I have the following piece of java method code: @Override public void applyStates(int timestamp, State[] states) { // Calculate the time diff between current time and the time stamp of the given ...
0
votes
1answer
35 views

Checking name E-mail and unit-test

Please tell me what you think. Is my code bad? Function checking #-*- coding: utf-8 -*- import re import unittest def email_check(mail): # E-mail as argument func compil = re.compile(r""" ...
2
votes
1answer
81 views

Method names for encapsulated unit testing logic. Which convention is better?

I have some C# unit tests which each basically perform the same steps but supply different arguments to the unit under test. I wanted to encapsulate the logic inside some "helper methods" but found ...
1
vote
2answers
54 views

Testing an Executor

I have written the following Executor: /** * <p>This executor guarantees that there is never more than one element waiting to be executed. If an element is * submitted for execution and ...
1
vote
3answers
39 views

Is my code unit testable

I've written a piece of code. Would like to know is the below piece of code unit testable or does it need any kind of refactoring. MatchCilentUrls is the primary method for matching two urls. Based ...
1
vote
1answer
22 views

Throwing error if settings / arguments are undefined is this a good breakout function?

var _ = require("underscore"); var checkSettingsUndefined = function(settings){ if(_.isEmpty(settings)){ throw new Error("settings are empty"); } } var Class = function(settings){ ...
1
vote
0answers
76 views

Code review on an API wrapper in C# wanted

I'm looking for remarks on pretty much anything. This has been my first project that's meant for use by others and I'd like to have it as clean as possible. I will post the main source code here but ...
0
votes
0answers
36 views

Zend Framework and Doctrine 2 - are my unit tests sufficient?

I'm quite new to Zend and unit testing in general. I have come up with a small application that uses Zend Framework 2 and Doctrine. It has only one model and controller and I want to run some unit ...
1
vote
1answer
186 views

Advice on Zend Framework 2 and Doctrine

I've just started looking at Zend Framework 2 and Doctrine ORM, with a view to possibly using it in one of my future products. So far I have a very simple application which allows the user to select ...
3
votes
1answer
80 views

Unit test an ExecutorService in a deamon

To execute tasks sequentially with a timeout I use ExecutorService.submit() and Future.get(). As I don't want to block calling clients, I implement producer–consumer pattern with a queue into a Thread ...
1
vote
1answer
48 views

Can these collision unit tests be improved?

I'm finding it a bit tedious to write unit tests for my collision class because there are so many variations of collisions that need testing. I see repetition in the set-up and assertion stages of ...
0
votes
2answers
60 views

Using MOQ In Unit Testing

I am fairly new to writing unit tests, and I was wondering if this approach I have taken is on the right track? Given the following interfaces/classes: public interface ILoggingService { void ...
0
votes
0answers
29 views

Guice custom behavior for testing, how is this solution?

I have a Java/Swing/Guice application that uses multiple frames. When the application runs normally, I just want some of these frames to hide (and the "master" frame can unhide them). When testing ...
1
vote
0answers
78 views

Unit testing event triggering

I am writing a unit test for a Dispatcher that will route a HTTP request to a specific Controller and invoke a specific method on that Controller. It will also trigger various events at different ...
1
vote
2answers
98 views

Refactor code to make it more testable

I have this code that works fine. But I would like to create some unit test for this class. Most of the code is in private or void type methods. Please help me refactor my class to make it more ...

15 30 50 per page