Skip to content

Commit

Permalink
returned back tests in fixture module
Browse files Browse the repository at this point in the history
resurrected almost all tests, some were irrelevant and removed
some may be resurrected later
  • Loading branch information
elucash committed Feb 13, 2015
1 parent b6ef9a6 commit 2f14f43
Show file tree
Hide file tree
Showing 47 changed files with 217 additions and 1,047 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -33,7 +33,7 @@
<module>value-ordinal</module> <module>value-ordinal</module>
<module>value-processor</module> <module>value-processor</module>
<module>value-standalone</module> <module>value-standalone</module>
<!-- <module>value-fixture</module> --> <module>value-fixture</module>
<module>gson</module> <module>gson</module>
<module>mongo</module> <module>mongo</module>
</modules> </modules>
Expand Down
15 changes: 10 additions & 5 deletions value-fixture/pom.xml
Expand Up @@ -16,11 +16,6 @@
</description> </description>


<dependencies> <dependencies>
<!--<dependency>
<groupId>org.immutables</groupId>
<artifactId>common</artifactId>
<version>${project.version}</version>
</dependency> -->
<dependency> <dependency>
<groupId>org.immutables.dependency</groupId> <groupId>org.immutables.dependency</groupId>
<artifactId>technology</artifactId> <artifactId>technology</artifactId>
Expand All @@ -42,6 +37,16 @@
<artifactId>value-ordinal</artifactId> <artifactId>value-ordinal</artifactId>
<version>${project.version}</version> <version>${project.version}</version>
</dependency> </dependency>
<dependency>
<groupId>org.immutables</groupId>
<artifactId>immutables-gson</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.immutables</groupId>
<artifactId>immutables-mongo</artifactId>
<version>${project.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.immutables</groupId> <groupId>org.immutables</groupId>
<artifactId>testing</artifactId> <artifactId>testing</artifactId>
Expand Down
1 change: 1 addition & 0 deletions value-fixture/src/InDefaultPackage.java
Expand Up @@ -17,6 +17,7 @@


@Value.Immutable @Value.Immutable
interface InDefaultPackage { interface InDefaultPackage {
int attr();
@Value.Immutable @Value.Immutable
static class ButNested {} static class ButNested {}
} }

This file was deleted.

5 changes: 2 additions & 3 deletions value-fixture/src/org/immutables/fixture/HasNullable.java
Expand Up @@ -15,16 +15,15 @@
*/ */
package org.immutables.fixture; package org.immutables.fixture;


import org.immutables.value.ext.Json; import org.immutables.gson.Gson;
import org.immutables.value.Value; import org.immutables.value.Value;
import javax.annotation.Nullable; import javax.annotation.Nullable;


@Value.Immutable(singleton = true) @Value.Immutable(singleton = true)
@Json.Marshaled @Gson.TypeAdapters
public abstract class HasNullable { public abstract class HasNullable {
@Nullable @Nullable
@Value.Parameter @Value.Parameter
@Json.ForceEmpty
public abstract Integer in(); public abstract Integer in();


@Nullable @Nullable
Expand Down
Expand Up @@ -19,7 +19,7 @@
import java.lang.annotation.Target; import java.lang.annotation.Target;
import java.util.Map; import java.util.Map;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import org.immutables.value.ext.Json; import org.immutables.gson.Gson;
import org.immutables.value.Value; import org.immutables.value.Value;


@Target(ElementType.TYPE_USE) @Target(ElementType.TYPE_USE)
Expand All @@ -28,8 +28,8 @@
@Target(ElementType.TYPE_USE) @Target(ElementType.TYPE_USE)
@interface TypeB {} @interface TypeB {}


@Value.Immutable //FIXME @Value.Immutable
@Json.Marshaled //FIXME @Gson.TypeAdapters
public abstract class HasTypeAnnotation { public abstract class HasTypeAnnotation {
@Nullable @Nullable
public abstract @TypeA @TypeB String str(); public abstract @TypeA @TypeB String str();
Expand Down
6 changes: 3 additions & 3 deletions value-fixture/src/org/immutables/fixture/JsonIgnore.java
Expand Up @@ -16,15 +16,15 @@
package org.immutables.fixture; package org.immutables.fixture;


import java.util.List; import java.util.List;
import org.immutables.gson.Gson;
import org.immutables.value.Value; import org.immutables.value.Value;
import org.immutables.value.ext.Json;


@Value.Immutable @Value.Immutable
@Json.Marshaled @Gson.TypeAdapters
public interface JsonIgnore { public interface JsonIgnore {
@Value.Parameter @Value.Parameter
int value(); int value();


@Json.Ignore @Gson.Ignore
List<Integer> values(); List<Integer> values();
} }
Expand Up @@ -15,11 +15,9 @@
*/ */
package org.immutables.fixture; package org.immutables.fixture;


import org.immutables.value.Value.Style.ImplementationVisibility;
import org.immutables.value.Value; import org.immutables.value.Value;


@Value.Immutable @Value.Immutable
@Value.Style(visibility = ImplementationVisibility.PACKAGE)
public abstract class PrimitiveDefault { public abstract class PrimitiveDefault {
@Value.Default @Value.Default
public boolean def() { public boolean def() {
Expand Down
4 changes: 2 additions & 2 deletions value-fixture/src/org/immutables/fixture/SillyAbstract.java
Expand Up @@ -15,9 +15,9 @@
*/ */
package org.immutables.fixture; package org.immutables.fixture;


import org.immutables.value.ext.Json; import org.immutables.gson.Gson;


@Json.Subclasses({ @Gson.ExpectedSubtypes({
SillySub1.class, SillySub1.class,
SillySub2.class SillySub2.class
}) })
Expand Down
14 changes: 6 additions & 8 deletions value-fixture/src/org/immutables/fixture/SillyDumb.java
Expand Up @@ -17,24 +17,22 @@


import com.google.common.base.Optional; import com.google.common.base.Optional;
import java.util.List; import java.util.List;
import org.immutables.value.ext.Json; import org.immutables.gson.Gson;
import org.immutables.value.Value; import org.immutables.value.Value;


@Value.Immutable @Value.Immutable
@Json.Marshaled @Gson.TypeAdapters
public abstract class SillyDumb { public abstract class SillyDumb {


@Json.Named("a") @Gson.Named("a")
@Json.ForceEmpty
public abstract Optional<Integer> a1(); public abstract Optional<Integer> a1();


@Json.Named("b") @Gson.Named("b")
@Json.ForceEmpty
public abstract List<String> b2(); public abstract List<String> b2();


@Json.Named("c") @Gson.Named("c")
public abstract Optional<Integer> c3(); public abstract Optional<Integer> c3();


@Json.Named("d") @Gson.Named("d")
public abstract List<String> d4(); public abstract List<String> d4();
} }
35 changes: 5 additions & 30 deletions value-fixture/src/org/immutables/fixture/SillyEntity.java
Expand Up @@ -15,56 +15,31 @@
*/ */
package org.immutables.fixture; package org.immutables.fixture;


import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonParser;
import com.google.common.primitives.UnsignedInteger; import com.google.common.primitives.UnsignedInteger;
import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.annotation.Nullable; import org.immutables.gson.Gson;
import org.immutables.value.ext.Json; import org.immutables.mongo.Mongo;
import org.immutables.value.ext.Mongo;
import org.immutables.value.Value; import org.immutables.value.Value;


@Value.Immutable @Value.Immutable
@Json.Import({SillyEntity.class})
@Mongo.Repository @Mongo.Repository
public abstract class SillyEntity { public abstract class SillyEntity {


@Mongo.Id @Mongo.Id
public abstract int id(); public abstract int id();


@Json.Named("v") @Gson.Named("v")
public abstract String val(); public abstract String val();


@Json.Named("p") @Gson.Named("p")
public abstract Map<String, Integer> payload(); public abstract Map<String, Integer> payload();


@Json.Named("i") @Gson.Named("i")
public abstract List<Integer> ints(); public abstract List<Integer> ints();


@Value.Derived @Value.Derived
public UnsignedInteger der() { public UnsignedInteger der() {
return UnsignedInteger.valueOf(1); return UnsignedInteger.valueOf(1);
} }

public static void marshal(JsonGenerator generator, UnsignedInteger integer) throws IOException {
generator.writeNumber(integer.doubleValue());
}

/**
* Unmarshal.
* @param parser the parser
* @param integerNull the integer null
* @param expectedClass the expected class
* @return the unsigned integer
* @throws IOException Signals that an I/O exception has occurred.
*/
public static UnsignedInteger unmarshal(
JsonParser parser,
@Nullable UnsignedInteger integerNull,
Class<UnsignedInteger> expectedClass)
throws IOException {
return UnsignedInteger.valueOf((long) parser.getDoubleValue());
}
} }
Expand Up @@ -15,16 +15,16 @@
*/ */
package org.immutables.fixture; package org.immutables.fixture;


import org.immutables.value.ext.Mongo; import org.immutables.gson.Gson;
import org.immutables.common.repository.Id; import org.immutables.mongo.Mongo;
import org.immutables.value.ext.Json; import org.immutables.mongo.types.Id;
import org.immutables.value.Value; import org.immutables.value.Value;


@Value.Immutable @Value.Immutable
@Mongo.Repository("ent2") @Mongo.Repository("ent2")
public abstract class SillyEntitySecond { public abstract class SillyEntitySecond {


@Json.Named("_id") @Gson.Named("_id")
@Value.Default @Value.Default
public Id id() { public Id id() {
return Id.generate(); return Id.generate();
Expand Down
4 changes: 2 additions & 2 deletions value-fixture/src/org/immutables/fixture/SillyIntWrap.java
Expand Up @@ -15,11 +15,11 @@
*/ */
package org.immutables.fixture; package org.immutables.fixture;


import org.immutables.value.ext.Json; import org.immutables.gson.Gson;
import org.immutables.value.Value; import org.immutables.value.Value;


@Value.Immutable(builder = false) @Value.Immutable(builder = false)
@Json.Marshaled @Gson.TypeAdapters
public abstract class SillyIntWrap { public abstract class SillyIntWrap {


@Value.Parameter @Value.Parameter
Expand Down
6 changes: 2 additions & 4 deletions value-fixture/src/org/immutables/fixture/SillyMapHolder.java
Expand Up @@ -18,16 +18,14 @@
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.immutables.value.ext.Json; import org.immutables.gson.Gson;
import org.immutables.value.Value; import org.immutables.value.Value;


@Value.Immutable @Value.Immutable
@Json.Marshaled @Gson.TypeAdapters
@Json.Import(SillyMarshalingRoutines.class)
public abstract class SillyMapHolder { public abstract class SillyMapHolder {


@Value.Parameter(order = 0) @Value.Parameter(order = 0)
@Json.ForceEmpty
public abstract Map<SillyValue, Integer> holder1(); public abstract Map<SillyValue, Integer> holder1();


@Value.Parameter(order = 1) @Value.Parameter(order = 1)
Expand Down
4 changes: 2 additions & 2 deletions value-fixture/src/org/immutables/fixture/SillyMapTup.java
Expand Up @@ -17,11 +17,11 @@


import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import java.util.Map; import java.util.Map;
import org.immutables.value.ext.Json; import org.immutables.gson.Gson;
import org.immutables.value.Value; import org.immutables.value.Value;


@Value.Immutable(builder = false) @Value.Immutable(builder = false)
@Json.Marshaled @Gson.TypeAdapters
public abstract class SillyMapTup { public abstract class SillyMapTup {


@Value.Parameter(order = 0) @Value.Parameter(order = 0)
Expand Down
4 changes: 2 additions & 2 deletions value-fixture/src/org/immutables/fixture/SillyPolyHost.java
Expand Up @@ -16,11 +16,11 @@
package org.immutables.fixture; package org.immutables.fixture;


import java.util.List; import java.util.List;
import org.immutables.value.ext.Json; import org.immutables.gson.Gson;
import org.immutables.value.Value; import org.immutables.value.Value;


@Value.Immutable @Value.Immutable
@Json.Marshaled @Gson.TypeAdapters
public abstract class SillyPolyHost { public abstract class SillyPolyHost {


public abstract List<SillyAbstract> s(); public abstract List<SillyAbstract> s();
Expand Down
8 changes: 4 additions & 4 deletions value-fixture/src/org/immutables/fixture/SillyPolyHost2.java
Expand Up @@ -16,20 +16,20 @@
package org.immutables.fixture; package org.immutables.fixture;


import com.google.common.base.Optional; import com.google.common.base.Optional;
import org.immutables.value.ext.Json; import org.immutables.gson.Gson;
import org.immutables.value.Value; import org.immutables.value.Value;


@Value.Immutable @Value.Immutable
@Json.Marshaled @Gson.TypeAdapters
public abstract class SillyPolyHost2 { public abstract class SillyPolyHost2 {


@Json.Subclasses({ @Gson.ExpectedSubtypes({
SillySub2.class, SillySub2.class,
SillySub3.class SillySub3.class
}) })
public abstract SillyAbstract s(); public abstract SillyAbstract s();


@Json.Subclasses({ @Gson.ExpectedSubtypes({
SillySub2.class, SillySub2.class,
SillySub3.class SillySub3.class
}) })
Expand Down
4 changes: 2 additions & 2 deletions value-fixture/src/org/immutables/fixture/SillyStructure.java
Expand Up @@ -17,11 +17,11 @@


import com.google.common.base.Optional; import com.google.common.base.Optional;
import java.util.List; import java.util.List;
import org.immutables.value.ext.Json; import org.immutables.gson.Gson;
import org.immutables.value.Value; import org.immutables.value.Value;


@Value.Immutable @Value.Immutable
@Json.Marshaled @Gson.TypeAdapters
public abstract class SillyStructure { public abstract class SillyStructure {


public abstract String attr1(); public abstract String attr1();
Expand Down
Expand Up @@ -15,18 +15,18 @@
*/ */
package org.immutables.fixture; package org.immutables.fixture;


import org.immutables.value.ext.Mongo;
import com.google.common.base.Optional; import com.google.common.base.Optional;
import java.util.List; import java.util.List;
import org.immutables.value.ext.Json; import org.immutables.gson.Gson;
import org.immutables.mongo.Mongo;
import org.immutables.value.Value; import org.immutables.value.Value;


@Value.Immutable @Value.Immutable
@Mongo.Repository @Mongo.Repository
@Json.Marshaled @Gson.TypeAdapters
public interface SillyStructureWithId { public interface SillyStructureWithId {


@Json.Named("_id") @Gson.Named("_id")
String id(); String id();


String attr1(); String attr1();
Expand Down
4 changes: 2 additions & 2 deletions value-fixture/src/org/immutables/fixture/SillySub1.java
Expand Up @@ -15,11 +15,11 @@
*/ */
package org.immutables.fixture; package org.immutables.fixture;


import org.immutables.value.ext.Json; import org.immutables.gson.Gson;
import org.immutables.value.Value; import org.immutables.value.Value;


@Value.Immutable @Value.Immutable
@Json.Marshaled @Gson.TypeAdapters
public abstract class SillySub1 extends SillyAbstract { public abstract class SillySub1 extends SillyAbstract {
public abstract int a(); public abstract int a();
} }
4 changes: 2 additions & 2 deletions value-fixture/src/org/immutables/fixture/SillySub2.java
Expand Up @@ -15,11 +15,11 @@
*/ */
package org.immutables.fixture; package org.immutables.fixture;


import org.immutables.value.ext.Json; import org.immutables.gson.Gson;
import org.immutables.value.Value; import org.immutables.value.Value;


@Value.Immutable @Value.Immutable
@Json.Marshaled @Gson.TypeAdapters
public abstract class SillySub2 extends SillyAbstract { public abstract class SillySub2 extends SillyAbstract {
public abstract String b(); public abstract String b();
} }

0 comments on commit 2f14f43

Please sign in to comment.