/* * Copyright (c) 2016-present, RxJava Contributors. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See * the License for the specific language governing permissions and limitations under the License. */ package io.reactivex.rxjava3.validators; import java.io.*; import java.util.*; import org.junit.Test; import io.reactivex.rxjava3.testsupport.TestHelper; /** * These tests verify the code style that a typical closing curly brace * and the next annotation @ indicator * are not separated by less than or more than one empty line. *
Thus this is detected: *
* }
* @Override
*
* * as well as *
* }
*
*
* @Override
*
*/
public class NewLinesBeforeAnnotation {
@Test
public void missingEmptyNewLine() throws Exception {
findPattern(0);
}
@Test
public void tooManyEmptyNewLines2() throws Exception {
findPattern(2);
}
@Test
public void tooManyEmptyNewLines3() throws Exception {
findPattern(3);
}
@Test
public void tooManyEmptyNewLines4() throws Exception {
findPattern(4);
}
@Test
public void tooManyEmptyNewLines5() throws Exception {
findPattern(5);
}
static void findPattern(int newLines) throws Exception {
File f = TestHelper.findSource("Flowable");
if (f == null) {
System.out.println("Unable to find sources of RxJava");
return;
}
Queue