IDEA-54000 Move java formatting tests to community edition

Moved from 'idea-tests' to 'java-tests' because java formatter belongs to community edition
This commit is contained in:
Denis Zhdanov
2010-04-19 19:27:51 +04:00
parent e8777a2477
commit 4e370a6a7c
41 changed files with 642 additions and 0 deletions
@@ -0,0 +1,17 @@
class A {
/**
* The <code>String</code> class represents character strings. All
* string literals in Java programs, such as <code>"abc"</code>, are
* implemented as instances of this class.
*
* Some text after empty line
*
* @author Lee Boynton
* @author Arthur van Hoff
* @version 1.152, 02/01/03
* @since JDK1.0
*/
void foo() {
}
}
@@ -0,0 +1,17 @@
class A {
/**
* The <code>String</code> class represents
* character strings. All string literals in Java
* programs, such as <code>"abc"</code>, are
* implemented as instances of this class.
* Some text after empty line
*
* @author Lee Boynton
* @author Arthur van Hoff
* @version 1.152, 02/01/03
* @since JDK1.0
*/
void foo() {
}
}
@@ -0,0 +1,11 @@
class Foo{
void foo() {
try
{
//whatever
}
catch(Exception ex)
{
}
}
}
@@ -0,0 +1,12 @@
class Foo {
void foo() {
try
{
//whatever
}
catch (Exception ex)
{
}
}
}
@@ -0,0 +1,72 @@
package br.com.vivo.torpedeiro.pull.impl;
import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;
import br.com.vivo.torpedeiro.pull.MensagemPull;
import br.com.vivo.torpedeiro.pull.PullDAO;
/**
* Implementa? padr?de {@link PullDAO} que realiza todas as opera?s utilizando SQL atrav?de um {@link
* JdbcTemplate} do Spring Framework.
*
* @author Marcus Brito
*/
public class PullDAOJdbcTemplate implements PullDAO
{
private static final int STATUS_INICIAL = -7;
private JdbcTemplate template;
public String buscarURLProvedor(String provedor)
{
String sql = "SELECT url FROM pull_url WHERE provedor = ?";
return (String) template.queryForObject(sql, new Object[]{provedor}, String.class);
}
public Long inserirMensagemHistorico(MensagemPull mensagem)
{
String sql = "" +
"INSERT INTO pull_historico (\n" +
" id_log,\n" +
" provedor,\n" +
" origem,\n" +
" destino,\n" +
" msg_originada,\n" +
" cod_erro,\n" +
" dt_recepcao\n" +
") VALUES (?, ?, ?, ?, ?, ?, sysdate)";
Long id = buscarProximoID();
template.update(sql, new Object[]{id, mensagem.getCodigoProvedor(),
mensagem.getMensagemOriginal().getOrigem(), mensagem.getMensagemOriginal().getDestino(),
mensagem.getMensagemOriginal().getMensagem(), STATUS_INICIAL});
return id;
}
public void atualizarMensagemHistorico(Long id, int status, String mensagem)
{
String sql = "" +
"UPDATE pull_historico\n" +
" SET cod_erro = ?,\n" +
" msg_recebida = ?,\n" +
" dt_resposta = SYSDATE\n" +
" WHERE id_log = ?";
template.update(sql, new Object[]{status, mensagem, id});
}
private long buscarProximoID()
{
return template.queryForLong("SELECT seq_id_log.nextval FROM dual");
}
/**
* @param ds O DataSource utilizado para acesso ao banco de dados.
*/
public void setDataSource(DataSource ds)
{
this.template = new JdbcTemplate(ds);
}
}
@@ -0,0 +1,73 @@
package br.com.vivo.torpedeiro.pull.impl;
import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;
import br.com.vivo.torpedeiro.pull.MensagemPull;
import br.com.vivo.torpedeiro.pull.PullDAO;
/**
* Implementa? padr?de {@link PullDAO} que realiza todas as opera?s utilizando SQL atrav?de um {@link
* JdbcTemplate} do Spring Framework.
*
* @author Marcus Brito
*/
public class PullDAOJdbcTemplate implements PullDAO
{
private static final int STATUS_INICIAL = -7;
private JdbcTemplate template;
public String buscarURLProvedor(String provedor)
{
String sql = "SELECT url FROM pull_url WHERE provedor = ?";
return (String) template.queryForObject(sql, new Object[]{provedor}, String.class);
}
public Long inserirMensagemHistorico(MensagemPull mensagem)
{
String sql = "" +
"INSERT INTO pull_historico (\n" +
" id_log,\n" +
" provedor,\n" +
" origem,\n" +
" destino,\n" +
" msg_originada,\n" +
" cod_erro,\n" +
" dt_recepcao\n" +
") VALUES (?, ?, ?, ?, ?, ?, sysdate)";
Long id = buscarProximoID();
template.update(sql, new Object[]{id, mensagem.getCodigoProvedor(),
mensagem.getMensagemOriginal().getOrigem(), mensagem.getMensagemOriginal().getDestino(),
mensagem.getMensagemOriginal().getMensagem(), STATUS_INICIAL});
return id;
}
public void atualizarMensagemHistorico(Long id, int status, String mensagem)
{
String sql = "" +
"UPDATE pull_historico\n" +
" SET cod_erro = ?,\n" +
" msg_recebida = ?,\n" +
" dt_resposta = SYSDATE\n" +
" WHERE id_log = ?";
template.update(sql, new Object[]{status, mensagem, id});
}
private long buscarProximoID()
{
return template.queryForLong("SELECT seq_id_log.nextval FROM dual");
}
/**
* @param ds O DataSource utilizado para acesso ao banco de dados.
*/
public void setDataSource(DataSource ds)
{
this.template = new JdbcTemplate(ds);
}
}
@@ -0,0 +1,6 @@
class Foo {
void foo(){
if (a)
foo();
}
}
@@ -0,0 +1,7 @@
class Foo {
void foo(){
if (a) {
foo();
}
}
}
@@ -0,0 +1,16 @@
class TestFormat
{
public void test(boolean isA, boolean isB, boolean isC) {
if (isA)
// doSomethingElse(1)
doSomething(1);
else if (isB)
// doSomethingElse(2)
doSomething(2);
else if (isC)
// doSomethingElse(3)
doSomething(3);
}
}
@@ -0,0 +1,20 @@
class TestFormat {
public void test(boolean isA, boolean isB, boolean isC) {
if (isA)
// doSomethingElse(1)
{
doSomething(1);
} else if (isB)
// doSomethingElse(2)
{
doSomething(2);
} else if (isC)
// doSomethingElse(3)
{
doSomething(3);
}
}
}
@@ -0,0 +1,6 @@
class Foo {
void foo(){
if (AAA == BBB ||
CCC) continue;
}
}
@@ -0,0 +1,7 @@
class Foo {
void foo() {
if (AAA == BBB ||
CCC) continue;
}
}
@@ -0,0 +1,5 @@
public class Y implements X {
public void doSomething() // this does something
{
}
}
@@ -0,0 +1,6 @@
public class Y implements X {
public void doSomething() // this does something
{
}
}
@@ -0,0 +1,32 @@
class Foo {
void foo() {
int i = 0;
int j = 0;
}
}
@@ -0,0 +1,17 @@
class Foo {
void foo() {
int i = 0;
int j = 0;
}
}
@@ -0,0 +1,13 @@
class A {
//comment1
void method()
//comment2
{
if (a)
//comment3
{
//comment4
}
//comment5
}
}
@@ -0,0 +1,13 @@
class A {
//comment1
void method()
//comment2
{
if (a)
//comment3
{
//comment4
}
//comment5
}
}
@@ -0,0 +1,9 @@
class Foo {
public void foo(){
return _status == EnhancedMemberOrderStatus.EDITING
|| _status == EnhancedMemberOrderStatus.RESUMING
|| _status == EnhancedMemberOrderStatus.OPEN;
}
}
@@ -0,0 +1,9 @@
class Foo {
public void foo() {
return _status == EnhancedMemberOrderStatus.EDITING
|| _status == EnhancedMemberOrderStatus.RESUMING
|| _status == EnhancedMemberOrderStatus.OPEN;
}
}
@@ -0,0 +1,23 @@
class A {
void foo(){
switch (x)
{
case 0:
{ // don't want the brace indented
break;
}
case 1:
{
break;
}
}
}
}
@@ -0,0 +1,23 @@
class A {
void foo() {
switch (x)
{
case 0:
{ // don't want the brace indented
break;
}
case 1:
{
break;
}
}
}
}
@@ -0,0 +1,6 @@
class A{
{
y = x++ + 6;
y = 6 + ++x;
}
}
@@ -0,0 +1,7 @@
class A {
{
y = x+++6;
y = 6+ ++x;
}
}
@@ -0,0 +1,5 @@
class Foo {
void foo(int a, int b, int c, int d) throws Exception, RuntimeException{
}
}
@@ -0,0 +1,6 @@
class Foo {
void foo(int a, int b, int c, int d)
throws Exception, RuntimeException {
}
}
@@ -0,0 +1,9 @@
class Foo{
void foo(int i,int j){
for(int i=0;i<1;i++){
}
if(a){}
foo(1,2);
}
}
@@ -0,0 +1,37 @@
class Foo{
void foo(){
if (a){
} else{
}
while (a){
}
for (int i = 0; i < 10; i++){
}
do{
} while (true);
switch (a){
default:
return;
}
try{
} catch (E e){
} finally{
}
synchronized (this){
}
int[] i = new int[]{1, 2, 3};
}
}
@@ -0,0 +1,37 @@
class Foo {
void foo() {
if (a) {
} else {
}
while (a) {
}
for (int i = 0; i < 10; i++) {
}
do {
} while (true);
switch (a) {
default:
return;
}
try {
} catch (E e) {
} finally {
}
synchronized (this) {
}
int[] i = new int[] {1, 2, 3};
}
}
@@ -0,0 +1,10 @@
class Foo {
void foo ( int i, int j ) {
for ( int i = 0; i < 1; i++ ) {
}
if ( a ) {
}
foo ( 1, 2 );
}
}
@@ -0,0 +1,11 @@
class Foo{
void foo(){
switch (a) {
case 0:
doCase0();
break;
default:
doDefault();
}
}
}
@@ -0,0 +1,12 @@
class Foo {
void foo() {
switch (a) {
case 0:
doCase0();
break;
default:
doDefault();
}
}
}
@@ -0,0 +1,9 @@
class Foo{
public void foo(){
LOG.bar();
synchronized (this){
bar();
bar();
}
}
}
@@ -0,0 +1,10 @@
class Foo {
public void foo() {
LOG.bar();
synchronized(this){
bar();
bar();
}
}
}
@@ -0,0 +1,8 @@
class Foo{
void foo(){
int someVariable = a ?
x :
y;
}
}
@@ -0,0 +1,9 @@
class Foo {
void foo() {
int someVariable = a ?
x :
y;
}
}
@@ -0,0 +1,9 @@
class Foo {
void foo() {
int someVariable = a ?
x :
y;
}
}
@@ -0,0 +1,16 @@
class C{
void method(){
try {
} catch (Exception e){
int i=0;
} catch (Exception e){
int i=0;
}catch (Exception e){
int i=0;
}catch (Exception e){
int i=0;
}catch (Exception e){
int i=0;
}
}
}
@@ -0,0 +1,16 @@
class C{
void method(){
try {
} catch (Exception e) {
int i = 0;
} catch (Exception e){
int i=0;
}catch (Exception e){
int i=0;
}catch (Exception e){
int i=0;
}catch (Exception e){
int i=0;
}
}
}
@@ -0,0 +1,5 @@
class Foo{
public void foo(){
assertEquals(map.get(new File("C:\\PerforceTest1\\created2.txt")), );
}
}
@@ -0,0 +1,6 @@
class Foo {
public void foo() {
assertEquals(map.get(new File("C:\\PerforceTest1\\created2.txt")), );
}
}