Home | History | Annotate | Download | only in validator
      1 package org.robolectric.annotation.processing.validator;
      2 
      3 import static com.google.common.truth.Truth.assertAbout;
      4 import static org.robolectric.annotation.processing.validator.SingleClassSubject.singleClass;
      5 
      6 import org.junit.Test;
      7 
      8 public class ImplementationValidatorTest {
      9 
     10   @Test
     11   public void implementationWithoutImplements_shouldNotCompile() {
     12     final String testClass = "org.robolectric.annotation.processing.shadows.ShadowImplementationWithoutImplements";
     13     assertAbout(singleClass())
     14         .that(testClass)
     15         .failsToCompile()
     16         .withErrorContaining("@Implementation without @Implements")
     17         .onLine(7);
     18   }
     19 
     20   @Test
     21   public void implementationWithIncorrectVisibility_shouldNotCompile() {
     22     final String testClass = "org.robolectric.annotation.processing.shadows.ShadowImplementationWithIncorrectVisibility";
     23     assertAbout(singleClass())
     24         .that(testClass)
     25         .failsToCompile()
     26         .withErrorContaining("@Implementation methods should be protected (preferred) or public (deprecated)")
     27         .onLine(17)
     28         .and()
     29         .withErrorContaining("@Implementation methods should be protected (preferred) or public (deprecated)")
     30         .onLine(21)
     31         .and()
     32         .withErrorContaining("@Implementation methods should be protected (preferred) or public (deprecated)")
     33         .onLine(31)
     34         .and()
     35         .withErrorContaining("@Implementation methods should be protected (preferred) or public (deprecated)")
     36         .onLine(34)
     37     ;
     38   }
     39 }
     40