Intellij: Change JUnit Test Class template - templates

I would like to customize the JUnit Test class template however I cannot find it anywhere in settings. This guy has the same problem. I can't find anything in File Templates or Live Templates. I'm using Intellij 11.

This is now solved in the latest IntelliJ IDEA / Android Studio. Go to:
Settings
-Editor
-File and Code Templates
-Code (tab)
-JUnit4 Test Class
edit the code in the right window.

The link provided by CrazyCoder suggests that this is not directly possible but that I you need to add if statements to the Class File Type template. I will probably split the template in two using a big if-else.

Related

How can I override core misc js in drupal 8

I have a problem with dialog in drupal 8, and I found a place that make me stuck.
There is a code in this file not work as my expected. Please see the image
I just want to do the simple thing is comment the line out like below:
I can't do this because this is core file. So I want to override this file or this function only.
I trying to use libraries-override but no hope. This is my code, I am newbie so this code may have mistake or wrong.
"capital" is my theme, not module
below is my theme structure:
Please help... I googled this issue for long time.
Better way would be:
libraries-override:
core/drupal.dialog: captial/dialog
I have solved it by myself:
Step 1: clone core js to your theme js like this:
Step 2: modify template library ([your-theme-name].libraries.yml)
Declare core file your need to add to your theme
Step 3: disable core files using your theme info file ([your-theme-name].info.yml) and add your files as library:
That's it :)
Any better idea? please suggest me more.

Is it possible to use templates when creating a scratch file in PyCharm?

I created a custom template file and I can use it from the "File"->"New..." menu option.
But I was expecting to see it also when creating a new scratch file using
"File"->"New Scratch File"
Is this even possible?
(I am using PyCharm 2017.1.2)
I think it's not possible: each time you create a scratch file, it's created from scratch.
Though, what's possible in order to simplify your life, is using Live Templates: you can create your own abbreviation, which can be expanded automatically to some portion of code. There are many examples in Settings -> Editor -> Live Templates so you can use them as an example.

Add new rule to Codan

I am using the integrated CODAN static code analysis tool in Eclipse CDT. But i want to add some rules to check naming conventions of my code. How can I create and add that kind of rules to Codan?
To add rules to Codan first of all you have to make modification in Plugin.xml file by adding problem and checker tag.
<checker
class="org.eclipse.cdt.codan.internal.checkers.NamespaceNaming"
id="org.eclipse.cdt.codan.internal.checkers.NamespaceNaming"
name="%checker.name.NamespaceNaming">
<problem
category="org.eclipse.cdt.codan.core.categories.CodeStyle"
defaultEnabled="true"
defaultSeverity="Error"
description="%problem.description.NamespaceNaming"
id="org.eclipse.cdt.codan.internal.checkers.NamespaceNaming"
messagePattern="%problem.messagePattern.NamespaceNaming"
multiple="true"
name="%problem.name.NamespaceNaming">
</problem>
Then in bundle.properties you have to add message and description of your problem. After which you have to create a class in Codan Source code, do what implementation you like to do in it (like you can create a pattern with regex so you can compare your file name with it).

Unit testing Freemarker template

I have a Freemarker template that I would like to create a test for. The test renders the freemarker template using some mock information. I would like to render the template to an external file so that I can eyeball the results (make sure the html is aligned, etc).
I am using a traditional maven project structure for this project. Does anyone have any suggestions on what would be the most appropriate directory to output this temporary test file from my unit test?
I think you'd want to output it to somewhere underneath the maven ${basedir}/target directory. You can then clean it up as part of mvn clean.

org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error processing GroovyPageView: Template not found

I am using Grails 1.3.7 and deploy to JBoss 5.1.1. when I try to access a page myPage.gsp in one of the plugins. I got the Template not found error.
the page is working ok when using grails run-app. and the template file are definitely in th correct location and it is NOT missing.
I had searched around this issue, there is nothing really out there. I am new to Grails, I cant understand why this file is not found as it is there.
File structure as following:
grailsPlugins
myplugin
grails-app
views
templates
_myTemplate.gsp
mypages
myPage.gsp
in the myPage.gsp, I have a line like this:
<g:render template="/templates/myTemplate"/>
Can anyone help on this?
I've encountered this same issue before, so just for reference for others, while adding the optional attribute plugin="myplugin" works to resolve the plugin location, it won't allow the application that installs the plugin to customize the myTemplate template(if there is ever a need to as there was in my case!)
I found that copying the templates over to the application on install or via a script, just like Spring Security copies login template when you run the s2-quickstart was the easiest way to completely resolve the issue.