Search in sources :

Example 1 with StringValues

use of com.google.auto.value.annotations.StringValues in project auto by google.

the class AutoAnnotationTest method testSimpleVarArgs.

@Test
public void testSimpleVarArgs() {
    StringValues expectedStringValues = AnnotatedClass.class.getAnnotation(StringValues.class);
    StringValues actualStringValues = newStringValuesVarArgs("oops");
    StringValues otherStringValues = newStringValuesVarArgs(new String[] {});
    new EqualsTester().addEqualityGroup(expectedStringValues, actualStringValues).addEqualityGroup(otherStringValues).testEquals();
}
Also used : EqualsTester(com.google.common.testing.EqualsTester) StringValues(com.google.auto.value.annotations.StringValues) Test(org.junit.Test)

Example 2 with StringValues

use of com.google.auto.value.annotations.StringValues in project auto by google.

the class AutoAnnotationTest method testStringQuoting.

@Test
public void testStringQuoting() {
    StringValues instance = newStringValues(new String[] { "", "\r\n", "hello, world", "Éamonn", "\007￯" });
    String expected = "@com.google.auto.value.annotations.StringValues(" + "[\"\", \"\\r\\n\", \"hello, world\", \"Éamonn\", \"\\007\\uffef\"])";
    assertEquals(expected, instance.toString());
}
Also used : StringValues(com.google.auto.value.annotations.StringValues) Test(org.junit.Test)

Example 3 with StringValues

use of com.google.auto.value.annotations.StringValues in project auto by google.

the class AutoAnnotationTest method testSimple.

@Test
public void testSimple() {
    StringValues expectedStringValues = AnnotatedClass.class.getAnnotation(StringValues.class);
    StringValues actualStringValues = newStringValues(new String[] { "oops" });
    StringValues otherStringValues = newStringValues(new String[] {});
    new EqualsTester().addEqualityGroup(expectedStringValues, actualStringValues).addEqualityGroup(otherStringValues).testEquals();
}
Also used : EqualsTester(com.google.common.testing.EqualsTester) StringValues(com.google.auto.value.annotations.StringValues) Test(org.junit.Test)

Example 4 with StringValues

use of com.google.auto.value.annotations.StringValues in project auto by google.

the class AutoAnnotationTest method testArraysAreCloned.

@Test
public void testArraysAreCloned() {
    String[] array = { "Jekyll" };
    StringValues stringValues = newStringValues(array);
    array[0] = "Hyde";
    assertEquals("Jekyll", stringValues.value()[0]);
    stringValues.value()[0] = "Hyde";
    assertEquals("Jekyll", stringValues.value()[0]);
}
Also used : StringValues(com.google.auto.value.annotations.StringValues) Test(org.junit.Test)

Aggregations

StringValues (com.google.auto.value.annotations.StringValues)4 Test (org.junit.Test)4 EqualsTester (com.google.common.testing.EqualsTester)2