[nbusers] netbeans junit templates don't seem to match generated tests

  • From: "tansaku" < >
  • To:
  • Subject: [nbusers] netbeans junit templates don't seem to match generated tests
  • Date: Fri, 01 Feb 2013 08:10:00 -0500

I can see the netbeans junit templates in Tools | Templates, and, e.g. 
TestClass for Junit 4.x starts like this:

<#-- FreeMarker template (see http://freemarker.org/) -->
<#assign licenseFirst = "/*">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#include "../Licenses/license-${project.license}.txt">

<#if package?? && package != "">
package ${package};


but the section on test methods is like this:

<#if testMethodsPlaceholder!false>
    // TODO add test methods here.
    // The methods must be annotated with annotation @Test. For example:
    //
    // @Test
    // public void hello() {}

</#if>

and what I get in the generated files looks something like this:

    public void testGetMinutesPurchased() {
        System.out.println("getMinutesPurchased");
        ParkingMeter instance = null;
        int expResult = 0;
        int result = instance.getMinutesPurchased();
        assertEquals(expResult, result);
        // TODO review the generated test code and remove the default call to 
fail.
        fail("The test case is a prototype.");
    }

which is great - all the individual tests being generated, but I'd love to 
slightly modify the template for that, but none of the JUnit templates (3.x 
or 4.x) seem to have templates for the individual test method.

Anyone know where I might find this?

Many thanks in advance






[nbusers] netbeans junit templates don't seem to match generated tests

tansaku 02/01/2013

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close