Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Avro] Fix unit test for untyped map schema generation. #282

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public static class RootType
{
@JsonAlias({"nm", "Name"})
public String name;

public int value;

List<String> other;
}

Expand Down Expand Up @@ -51,7 +51,7 @@ public ByteBuffer getBytes() {
}
}
}

/*
/**********************************************************
/* Tests
Expand Down Expand Up @@ -94,21 +94,21 @@ public void testEmployee() throws Exception
AvroSchema schema = gen.getGeneratedSchema();
assertNotNull(schema);

String json = schema.getAvroSchema().toString(true);
String json = schema.getAvroSchema().toString(true);
assertNotNull(json);
AvroSchema s2 = MAPPER.schemaFrom(json);
assertNotNull(s2);

Employee empl = new Employee();
empl.name = "Bobbee";
empl.age = 39;
empl.emails = new String[] { "bob@aol.com", "bobby@gmail.com" };
empl.boss = null;

// So far so good: try producing actual Avro data...
byte[] bytes = MAPPER.writer(schema).writeValueAsBytes(empl);
assertNotNull(bytes);

// and bring it back, too
Employee e2 = getMapper().readerFor(Employee.class)
.with(schema)
Expand All @@ -131,7 +131,7 @@ public void testMap() throws Exception
assertNotNull(s2);

// should probably verify, maybe... ?

// System.out.println("Map schema:\n"+json);
}

Expand Down Expand Up @@ -165,10 +165,8 @@ public void testSchemaForUntypedMap() throws Exception
try {
MAPPER.schemaFor(Map.class);
fail("Not expected to work yet");
} catch (InvalidDefinitionException e) {
verifyException(e, "\"Any\" type");
verifyException(e, "not supported");
verifyException(e, "`java.lang.Object`");
} catch (UnsupportedOperationException e) {
verifyException(e, "Maps with non-stringable keys are not supported yet");
}
}
}