Put DefaultBindContext.postgresArrayString under test.
This commit is contained in:
parent
1ab948e62d
commit
f0aca1e62f
@ -0,0 +1,33 @@
|
||||
package org.jooq.impl;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class PostgresArrayEscapingTest {
|
||||
@Test(expected=NullPointerException.class)
|
||||
public void nullObjectShouldNotWork() {
|
||||
DefaultBindContext.postgresArrayString(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleStrings() {
|
||||
assertEquals("{\"foo\"}", DefaultBindContext.postgresArrayString(new String[]{"foo"}));
|
||||
assertEquals("{\"foo\", \"bar\"}", DefaultBindContext.postgresArrayString(new String[]{"foo", "bar"}));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stringsWithSingleQuotesAreFine() {
|
||||
assertEquals("{\"'foo\"}", DefaultBindContext.postgresArrayString(new String[]{"'foo"}));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void numbers() {
|
||||
assertEquals("{\"1\", \"2\"}", DefaultBindContext.postgresArrayString(new Object[]{1, 2}));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nulls() {
|
||||
assertEquals("{null}", DefaultBindContext.postgresArrayString(new Object[]{null}));
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user