java Programming Glossary: tests
Do you ever use the volatile keyword in Java? http://stackoverflow.com/questions/106591/do-you-ever-use-the-volatile-keyword-in-java to control whether some code continues a loop. The loop tests the volatile value and continues if it is true . The condition.. a stop method. The loop sees false and terminates when it tests the value after the stop method completes execution. The book..
How do I calculate someone's age in Java? http://stackoverflow.com/questions/1116123/how-do-i-calculate-someones-age-in-java not even sure this works correctly since I have no unit tests in place yet . java date calendar share improve this question..
Error java.lang.OutOfMemoryError: GC overhead limit exceeded http://stackoverflow.com/questions/1393486/error-java-lang-outofmemoryerror-gc-overhead-limit-exceeded exceeded I get this error message as I execute my JUnit tests java.lang.OutOfMemoryError GC overhead limit exceeded I know..
Why should the interface for a Java class be prefered? http://stackoverflow.com/questions/147468/why-should-the-interface-for-a-java-class-be-prefered If you do you'll find later that it's easier to add unit tests to your code using Mocking techniques and to change the underlying..
whats the difference between “.equals and ==” http://stackoverflow.com/questions/1643067/whats-the-difference-between-equals-and compares two references for non primitives that is i.e. it tests whether the two operands refer to the same object. However the..
Avoiding “!= null” statements in Java? http://stackoverflow.com/questions/271526/avoiding-null-statements-in-java is null or not. So my code get splattered with these tests. Nevertheless thanks a lot for your answers I got a bunch of..
Fastest way to determine if an integer's square root is an integer http://stackoverflow.com/questions/295579/fastest-way-to-determine-if-an-integers-square-root-is-an-integer sqrt sqrt n default return false Notes According to John's tests using or statements is faster in C than using a switch but in..
How slow are Java exceptions? http://stackoverflow.com/questions/299068/how-slow-are-java-exceptions thinking it may have been the JVM warming up. In all my tests the throw was at least as fast as the return if not faster up.. faster . I am completely open to the possibility that my tests were wrong but I haven't seen anything out there in the way..
Validating input using java.util.Scanner http://stackoverflow.com/questions/3059333/validating-input-using-java-util-scanner Here's an example of performing multiple hasNextXXX tests. Scanner sc new Scanner System.in while sc.hasNext exit System.out.println.. long 100000000000 exit Note that the order of the tests matters. If a Scanner hasNextInt then it also hasNextLong but..
Switch Statement with Strings in Java http://stackoverflow.com/questions/338206/switch-statement-with-strings-in-java the label. The corresponding case is an if statement that tests string equality if there are collisions on the hash the test..
Unicode equivalents for \w and \b in Java regular expressions? http://stackoverflow.com/questions/4304928/unicode-equivalents-for-w-and-b-in-java-regular-expressions I may include my gigatester but it ™s not written as JUnit tests. Addendum I have good news and bad news. The good news is that..
Migrating from JSF 1.2 to JSF 2.0 http://stackoverflow.com/questions/4441713/migrating-from-jsf-1-2-to-jsf-2-0 as per their instructions. Best is to just write unit tests run them before and after the upgrade and fix any issues individually...
Generate/get xpath from XML node java http://stackoverflow.com/questions/4746299/generate-get-xpath-from-xml-node-java EDIT Reason for doing this is .. I'm writing automated tests in jmeter so for every request I need to verify that request..
Why is subtracting these two times (in 1927) giving a strange result? http://stackoverflow.com/questions/6841333/why-is-subtracting-these-two-times-in-1927-giving-a-strange-result questions like this in Noda Time in the form of unit tests ... The test has now been changed but it just goes to show not..
Why are static variables considered evil? http://stackoverflow.com/questions/7026507/why-are-static-variables-considered-evil of an object I can reason about its new state within tests. If I use code which is using static variables it could be in..
Why do I need to nest a component with rendered=“#{some}” in another component when I want to ajax-update it? http://stackoverflow.com/questions/9010734/why-do-i-need-to-nest-a-component-with-rendered-some-in-another-component-w After a search it is not null checked in multiple tests can be null but not in the testing I am doing . Now. This does..
Efficiency of Java “Double Brace Initialization”? http://stackoverflow.com/questions/924285/efficiency-of-java-double-brace-initialization 15 16 milliseconds. The results for 10 runs of the two tests were the following Test1 Times ms Test2 Times ms 187 0 203..
Why is Singleton considered an anti pattern in Java world sometimes? http://stackoverflow.com/questions/11292109/why-is-singleton-considered-an-anti-pattern-in-java-world-sometimes care about how many instances of the Calculator exist. Tests can inject a dummy Calculator that make testing easy. Concurrency..
Unrooted Tests http://stackoverflow.com/questions/120889/unrooted-tests Tests When running all my tests in Eclipse Eclipse 3.4 'Ganymede'.. Eclipse 3.4 'Ganymede' one test is listed under Unrooted Tests . I'm using Junit 3.8 and this particular test extends TestCase... org.junit.Before import org.junit.Test public class MyTests Notice we don't extent TestCases anymore @Before public void..
Bamboo Ant Task fails when running junit task http://stackoverflow.com/questions/16481801/bamboo-ant-task-fails-when-running-junit-task junit Running me.jussi.kingdombuilder.SimplerTest junit Tests run 1 Failures 0 Errors 0 Skipped 0 Time elapsed 0 062 sec main.. refid junit.class.path javac target Run the JUnit Tests Output is XML could also be plain target name junit depends..
Custom JUnit Report? http://stackoverflow.com/questions/1727616/custom-junit-report the ant tasks 'junit' and 'junitreport' to run my JUnit Tests and generate a report at the end Unit Test Results . Is it there..
Automating unit tests (junit) for Eclipse Plugin development http://stackoverflow.com/questions/255370/automating-unit-tests-junit-for-eclipse-plugin-development I found this article Automating Eclipse PDE Unit Tests using Ant incredibly helpful. It provides code and approach..
Windows shortcut (.lnk) parser in Java? http://stackoverflow.com/questions/309495/windows-shortcut-lnk-parser-in-java shortcut public String getRealFilename return real_file Tests if the shortcut points to a local resource. @return true if.. false otherwise public boolean isLocal return isLocal Tests if the shortcut points to a directory. @return true if the 'directory'..
Java double comparison epsilon http://stackoverflow.com/questions/356807/java-double-comparison-epsilon 0.00001 Returns true if two doubles are considered equal. Tests if the absolute difference between two doubles has a difference.. EPSILON Returns true if two doubles are considered equal. Tests if the absolute difference between the two doubles has a difference..
JUnit test with dynamic number of tests http://stackoverflow.com/questions/358802/junit-test-with-dynamic-number-of-tests share improve this question Take a look at Parameterized Tests in JUnit 4. Actually I did this a few days ago. I'll try to..
How to run test methods in specific order in JUnit4? http://stackoverflow.com/questions/3693626/how-to-run-test-methods-in-specific-order-in-junit4 is a practice that the authors don't want to promote. Tests should be independent they shouldn't be coupled and violating..
Why does this go into an infinite loop? http://stackoverflow.com/questions/3831341/why-does-this-go-into-an-infinite-loop yesterday a student wrote the following code public class Tests public static void main String args throws Exception int x 0.. with 0 as value update Here's the bytecode public class Tests extends java.lang.Object public Tests Code 0 aload_0 1 invokespecial.. public class Tests extends java.lang.Object public Tests Code 0 aload_0 1 invokespecial #1 Method java lang Object. init..
How can I improve my junit tests http://stackoverflow.com/questions/589603/how-can-i-improve-my-junit-tests integration but is a bit frustrating for developers. Tests cannot be run isolated the best you can do is to stop after..
Maven does not find JUnit tests to run http://stackoverflow.com/questions/6178583/maven-does-not-find-junit-tests-to-run ClassUnderTest.java my_program src test java ClassUnderTestTests.java pom.xml xml version 1.0 encoding UTF 8 project xmlns http.. public int functionUnderTest int n return n ClassUnderTestTests.java import org.junit.Assert import org.junit.Before import.. import org.junit.Test public class ClassUnderTestTests private ClassUnderTest o @Before public void setUp o new ClassUnderTest..
osgi: Using ServiceFactories? http://stackoverflow.com/questions/7033222/osgi-using-servicefactories encoding configuration plugin plugin Unit Tests groupId org.apache.maven.plugins groupId artifactId maven.. excludes configuration plugin plugin Integration Tests groupId org.codehaus.mojo groupId artifactId failsafe maven..
How to set JVM parameters for Junit Unit Tests? http://stackoverflow.com/questions/7579776/how-to-set-jvm-parameters-for-junit-unit-tests to set JVM parameters for Junit Unit Tests I have some Junit unit tests that require a large amount of..
|