Unverified Commit 47bfbef7 authored by Philippe Lafoucrière's avatar Philippe Lafoucrière Committed by Lukas Eipert

Add java files to avoid 404s on some links

parent faa5b6bd
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gitlab.security_products.tests</groupId>
<artifactId>java-maven</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>java-maven</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.7.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty</artifactId>
<version>3.9.1.Final</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>3.3.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.2</version>
</dependency>
</dependencies>
</project>
package com.gitlab.security_products.tests;
import java.security.Key;
import java.security.SecureRandom;
import java.util.Random;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
/**
* Hello world!
*
*/
public class App
{
public static void main( String[] args )
{
System.out.println( "Hello World!" );
}
// This method triggers a findbugs issue with "BAD_PRACTICE" category
public Boolean booleanMethod() {
return null;
}
// This method triggers a findbugs issue with "SECURITY" category
public void insecureCypher() {
try {
Cipher c = Cipher.getInstance("AES/ECB/NoPadding");
Key k = KeyGenerator.getInstance("AES").generateKey();
SecureRandom r = new SecureRandom();
c.init(Cipher.ENCRYPT_MODE, k, r);
byte[] plainText= "plainText".getBytes();
byte[] cipherText = c.doFinal(plainText);
} catch (Exception e) {/* LOG YOUR EXCEPTION */}
}
// This method triggers a findbugs issue with "SECURITY" category (needs findsecbugs plugin)
String generateSecretToken1() {
Random r = new Random();
return Long.toHexString(r.nextLong());
}
// This method triggers a findbugs issue with "SECURITY" category (needs findsecbugs plugin)
String generateSecretToken2() {
Random r = new Random();
return Long.toHexString(r.nextLong());
}
}
package com.gitlab.security_products.tests;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment